...
This commit is contained in:
@@ -122,11 +122,60 @@ namespace Hushian.WebApi.Controllers.v1
|
||||
return Response.Success ? Ok(Response.Value)
|
||||
: BadRequest(Response.Errors);
|
||||
}
|
||||
[HttpGet("ChatIsFinish/{ChatID}")]
|
||||
[HttpPut("ChatIsFinish/{ChatID}")]
|
||||
[Authorize(Roles = "Company,Exper")]
|
||||
public async Task<ActionResult> ChatIsFinish(int ChatID)
|
||||
{
|
||||
return await _chatService.FinishChat(ChatID) ? NoContent()
|
||||
|
||||
int CompanyID = 0;
|
||||
if (User.IsInRole("Exper"))
|
||||
{
|
||||
string strExperID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
|
||||
int ExperID = Convert.ToInt32(strExperID);
|
||||
|
||||
CompanyID = await _experService.GetCompanyIDExper(ExperID);
|
||||
}
|
||||
else if (User.IsInRole("Company"))
|
||||
{
|
||||
string strCompanyID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
|
||||
CompanyID = Convert.ToInt32(strCompanyID);
|
||||
}
|
||||
|
||||
return await _chatService.FinishChat(ChatID, CompanyID) ? NoContent()
|
||||
: BadRequest(new List<string> { "خطا در بروزرسانی وضعیت" });
|
||||
}
|
||||
[HttpPut("OpenChat/{ChatID}")]
|
||||
[Authorize(Roles = "Company,Exper")]
|
||||
public async Task<ActionResult> OpenChat(int ChatID)
|
||||
{
|
||||
|
||||
int CompanyID = 0;
|
||||
int? ExperID =null;
|
||||
if (User.IsInRole("Exper"))
|
||||
{
|
||||
string strExperID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
|
||||
ExperID = Convert.ToInt32(strExperID);
|
||||
|
||||
CompanyID = await _experService.GetCompanyIDExper(ExperID.GetValueOrDefault());
|
||||
}
|
||||
else if (User.IsInRole("Company"))
|
||||
{
|
||||
string strCompanyID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
|
||||
CompanyID = Convert.ToInt32(strCompanyID);
|
||||
}
|
||||
|
||||
return await _chatService.OpenChat(ChatID, CompanyID, ExperID) ? NoContent()
|
||||
: BadRequest(new List<string> { "خطا در بروزرسانی وضعیت" });
|
||||
}
|
||||
[HttpPut("ChatIsFinishFromUser/{ChatID}")]
|
||||
[Authorize(Roles = "User")]
|
||||
public async Task<ActionResult> ChatIsFinishFromUser(int ChatID)
|
||||
{
|
||||
string strUserID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
|
||||
int UserID = Convert.ToInt32(strUserID);
|
||||
|
||||
|
||||
return await _chatService.FinishChatFromUser(ChatID, UserID) ? NoContent()
|
||||
: BadRequest(new List<string> { "خطا در بروزرسانی وضعیت" });
|
||||
}
|
||||
[HttpPut("MarkAsReadChatItem/{ConversationItemID}")]
|
||||
|
Reference in New Issue
Block a user