public async Task UpdateCommander(UpdateCommanderDto commanderDto) { var commander = await _commanderRepository.GetByPesel(commanderDto.Pesel); commander = CommanderMapper.UpdateCommanderMap(commanderDto, commander); await _commanderRepository.UpdateCommander(commander); }
private async Task <bool> IfExistTask(string email, string pesel) { var soldier = await _soldierRepository.GetByEmail(email); if (soldier != null) { return(true); } soldier = await _soldierRepository.GetByPesel(pesel); if (soldier != null) { return(true); } var commander = await _commanderRepository.GetByEmail(email); if (commander != null) { return(true); } commander = await _commanderRepository.GetByPesel(pesel); if (commander != null) { return(true); } var admin = await _adminRepository.GetByEmail(email); if (admin != null) { return(true); } admin = await _adminRepository.GetByPesel(pesel); if (admin != null) { return(true); } return(false); }
public static Company UpdateCompanyMap(UpdateCompanyDto updateCompany, Company cl, ICommanderRepository commanderRepository) { cl.Name = updateCompany.Name; cl.CommanderId = commanderRepository.GetByPesel(updateCompany.CommanderId).Result.Id; return(cl); }