...
This commit is contained in:
@@ -8,6 +8,7 @@ using Hushian.Domain.Entites;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -67,7 +68,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<List<Read_ExperDto>?> GetExpersInCompany(int companyID)
|
||||
public async Task<List<Read_ExperDto>> GetExpersInCompany(int companyID)
|
||||
=> _mapper.Map<List<Read_ExperDto>>(await _ExperRepository.Get().Where(w => w.CompanyID == companyID).ToListAsync());
|
||||
public async Task<Read_ExperDto?> GetExpersInGroup(int GroupID)
|
||||
=> _mapper.Map<Read_ExperDto>(await _ExperRepository.Get().Where(w => w.EG.Any(a => a.GroupID == GroupID)).ToListAsync());
|
||||
@@ -77,8 +78,21 @@ namespace Hushian.Application.Services
|
||||
exper.FullName = model.FullName;
|
||||
return await _ExperRepository.UPDATEBool(exper);
|
||||
}
|
||||
public async Task<bool> ChangeAvailableExper(int ExperID,int CompanyID,bool Available)
|
||||
{
|
||||
var exper = await _ExperRepository.Get().FirstOrDefaultAsync(w => w.ID == ExperID && w.CompanyID==CompanyID);
|
||||
if (exper == null) return false;
|
||||
exper.Available = Available;
|
||||
return await _ExperRepository.UPDATEBool(exper);
|
||||
}
|
||||
public async Task<bool> CheckExperInCompany(int CompanyID, int ExperID)
|
||||
=>await _ExperRepository.Get().AnyAsync(w => w.ID == ExperID && w.CompanyID==CompanyID);
|
||||
public async Task<bool> DeleteExper(int ExperID, int CompanyID)
|
||||
{
|
||||
var exper = await _ExperRepository.Get().FirstOrDefaultAsync(w => w.ID == ExperID && w.CompanyID == CompanyID);
|
||||
if (exper == null) return false;
|
||||
return await _ExperRepository.DELETE(exper);
|
||||
}
|
||||
public async Task<ResponseBase<bool>> ChangePasswordExperFromExper(ChangePasswordDto model, int ExperID)
|
||||
{
|
||||
ResponseBase<bool> Response = new();
|
||||
@@ -135,5 +149,11 @@ namespace Hushian.Application.Services
|
||||
}
|
||||
return Response;
|
||||
}
|
||||
public async Task<int> GetCompanyIDExper(int ExperID)
|
||||
{
|
||||
var exper = await _ExperRepository.Get().FirstOrDefaultAsync(w => w.ID == ExperID);
|
||||
if (exper == null) return 0;
|
||||
return exper.CompanyID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user