...
This commit is contained in:
@@ -12,16 +12,18 @@ namespace Hushian.Application.Services
|
||||
public class ExperService
|
||||
{
|
||||
private readonly IGenericRepository<Company> _CompanyRepository;
|
||||
private readonly IGenericRepository<User> _UserRepository;
|
||||
private readonly IGenericRepository<Exper> _ExperRepository;
|
||||
private readonly VerificationService _VerificationService;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
public ExperService(IGenericRepository<Exper> experRepository, VerificationService verificationService, IMapper mapper, IGenericRepository<Company> companyRepository)
|
||||
public ExperService(IGenericRepository<Exper> experRepository, VerificationService verificationService, IMapper mapper, IGenericRepository<Company> companyRepository, IGenericRepository<User> userRepository)
|
||||
{
|
||||
_ExperRepository = experRepository;
|
||||
_VerificationService = verificationService;
|
||||
_mapper = mapper;
|
||||
_CompanyRepository = companyRepository;
|
||||
_UserRepository = userRepository;
|
||||
}
|
||||
|
||||
public async Task<ResponseBase<bool>> ADDExper(ADD_ExperDto dto, int CompanyID)
|
||||
@@ -64,7 +66,7 @@ namespace Hushian.Application.Services
|
||||
}
|
||||
public async Task<Read_ExperDto?> GetInfoExper(int ExperID)
|
||||
=> _mapper.Map<Read_ExperDto>(await _ExperRepository.Get().FirstOrDefaultAsync(w => w.ID == ExperID));
|
||||
public async Task<CurrentUserInfo?> GetCurrentUserInfo(int CompanyID, int? ExperID)
|
||||
public async Task<CurrentUserInfo?> GetCurrentUserInfo(int CompanyID, int? ExperID, int? UserID)
|
||||
{
|
||||
if (ExperID.HasValue)
|
||||
{
|
||||
@@ -76,6 +78,16 @@ namespace Hushian.Application.Services
|
||||
Role = "Exper"
|
||||
}).FirstOrDefaultAsync();
|
||||
}
|
||||
else if (UserID.HasValue)
|
||||
{
|
||||
return await _UserRepository.Get().Where(w => w.ID == UserID).Select(s => new CurrentUserInfo
|
||||
{
|
||||
CompanyID = 0,
|
||||
UserID = UserID,
|
||||
Username = s.Mobile,
|
||||
Role = "User"
|
||||
}).FirstOrDefaultAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
return await _CompanyRepository.Get().Where(w => w.ID == CompanyID).Select(s => new CurrentUserInfo
|
||||
|
Reference in New Issue
Block a user