GetExpersCompany

GetGroupsCompany
This commit is contained in:
mmrbnjd
2025-07-25 21:29:57 +03:30
parent d4c4bb2ffd
commit 29107ce9c6
10 changed files with 88 additions and 42 deletions

View File

@@ -33,11 +33,30 @@ namespace Hushian.WebApi.Controllers.v1
return response.Success ? NoContent()
: BadRequest(response.Errors);
}
[HttpGet("GetExpersCompany/{CompanyID}")]
[HttpGet("GetExpersCompany")]
[Authorize]
public async Task<ActionResult> GetExpersCompany(int CompanyID, int PageIndex = 1, int PageSize = 10)
public async Task<ActionResult> GetExpersCompany(int? CompanyID)
{
var response = await _experService.GetExpersInCompany(CompanyID);
if (!CompanyID.HasValue)
{
if (!CompanyID.HasValue)
{
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);
}
}
}
var response = await _experService.GetExpersInCompany(CompanyID.GetValueOrDefault());
return Ok(response);
}