public async Task UpdatePilotAsync(int id, PilotUpdateDto updateDto) { var pilot = await context.Pilots.FirstOrDefaultAsync(x => x.Id == id); if (pilot == null) { throw new Exception($"Pilot with id: {id} not found."); } pilot = updateDto.UpdateModelObject(pilot); await context.SaveChangesAsync(); }
public async Task UpdatePilot(int id, [FromBody] PilotUpdateDto updateDto) { await pilotService.UpdatePilotAsync(id, updateDto); }
public async Task UpdatePilotAsync(int id, PilotUpdateDto updateDto) { await pilotRepository.UpdatePilotAsync(id, updateDto); }