public async Task <IActionResult> GetAccidentAsync([FromRoute] string accidentId) { Accident accident = await this.accidentService.GetAccidentAsync(accidentId) .ConfigureAwait(false); return(Ok(AccidentDto.From(accident))); }
public async Task <IActionResult> CreateAccidentAsync([FromBody] AccidentDto accidentDto) { if (accidentDto == null) { return(BadRequest()); } Accident accident = await this.accidentService .CreateAccidentAsync(accidentDto.ToModel()) .ConfigureAwait(false); if (accident == null) { return(BadRequest()); } return(Ok(AccidentDto.From(accident))); }