Beispiel #1
0
        public async Task ExecuteAsync(UpdatePilotCommand command)
        {
            var pilot = await _pilotRepository.GetById(command.Id);

            if (pilot == null)
            {
                throw new Exception("Pilot with this Id does not exist");
            }

            pilot.FirstName   = command.FirstName ?? pilot.FirstName;
            pilot.LastName    = command.LastName ?? pilot.LastName;
            pilot.DateOfBirth = command.DateOfBirth;
            pilot.Experience  = command.Experience;

            await _pilotRepository.Update(pilot);
        }
		public void UpdatePilot(int id, PilotDTO item)
		{
			pilotRepo.Update(id, Mapper.Map<PilotDTO, Pilot>(item));
		}