public async Task ExecuteAsync(CreatePilotCommand command) { if (await _pilotRepository.GetById(command.Id) != null) { throw new Exception("Pilot with same Id already exists"); } var pilot = _mapper.Map <Airport.Domain.Entities.Pilot>(command); await _pilotRepository.Create(pilot); }
public void CreatePilot(PilotDTO item) { pilotRepo.Create(Mapper.Map<PilotDTO, Pilot>(item)); }