This commit is contained in:
mmrbnjd
2025-07-30 16:39:37 +03:30
parent b3167b83b9
commit 5731c9ff97
6 changed files with 48 additions and 12 deletions

View File

@@ -83,11 +83,12 @@ namespace Hushian.WebApi.Controllers.v1
return response != null ? Ok(response) : BadRequest(new List<string> { "یافت نشد" });
}
[HttpGet("GetCurrentUserInfo")]
[Authorize(Roles = "Exper,Company")]
[Authorize(Roles = "Exper,Company,User")]
public async Task<ActionResult> GetCurrentUserInfo()
{
int CompanyID = 0;
int? ExperID = null;
int? UserID = null;
if (User.IsInRole("Exper"))
{
string strExperID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
@@ -99,8 +100,13 @@ namespace Hushian.WebApi.Controllers.v1
string strCompanyID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
CompanyID = Convert.ToInt32(strCompanyID);
}
else if (User.IsInRole("User"))
{
string strUserID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
UserID = Convert.ToInt32(strUserID);
}
var response = await _experService.GetCurrentUserInfo(CompanyID,ExperID);
var response = await _experService.GetCurrentUserInfo(CompanyID,ExperID,UserID);
return response != null ? Ok(response) : BadRequest(new List<string> { "یافت نشد" });
}
[HttpPut("ExperEditingFromManager/{ExperID}")] //ویرایش کارشناس توسط مدیرش