コード例 #1
0
ファイル: PilotRepository.cs プロジェクト: SutoZ/FormulaRace
        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();
        }
コード例 #2
0
ファイル: PilotController.cs プロジェクト: SutoZ/FormulaRace
 public async Task UpdatePilot(int id, [FromBody] PilotUpdateDto updateDto)
 {
     await pilotService.UpdatePilotAsync(id, updateDto);
 }
コード例 #3
0
 public async Task UpdatePilotAsync(int id, PilotUpdateDto updateDto)
 {
     await pilotRepository.UpdatePilotAsync(id, updateDto);
 }