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

@@ -12,11 +12,11 @@ namespace Hushian.WebApi.Controllers.v1
public class GroupController : ControllerBase
{
private readonly GroupService _groupService;
private readonly CompanyService _companyService;
public GroupController(GroupService groupService, CompanyService companyService)
private readonly ExperService _experService;
public GroupController(GroupService groupService, ExperService experService)
{
_groupService = groupService;
_companyService = companyService;
_experService = experService;
}
[HttpPost("AddGroup")]
@@ -76,8 +76,19 @@ namespace Hushian.WebApi.Controllers.v1
if (!CompanyID.HasValue)
{
string strCompanyID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
CompanyID = Convert.ToInt32(strCompanyID);
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 _groupService.GetGroupsCompany(CompanyID.Value);
return Ok(response);