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> AccidentDownload(string carreg) { AccidentDto response = null; string res = string.Empty; var temp = await carDetailsBusinessLogic.AccidentDownloadAsync(carreg); if (temp != null) { response = temp; } else { return(Ok("Download Link expire or you have not submit the Request")); } return(Ok(response)); }
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))); }
/// <summary> /// Method to Download Report for Accident after Requesting /// </summary> /// <param name="carReg"></param> /// <returns></returns> public async Task <AccidentDto> AccidentDownloadAsync(string carReg) { AccidentDto response = null; var caheData = _cache.Get(carReg); await Task.Run(() => { if (caheData != null) { foreach (var data in caheData.TestData) { if (data.CarRegNumber.Equals(carReg)) { response = data.Accident; } } } }); return(response); }
public async Task <IActionResult> UpdateAccidentAsync([FromRoute] string accidentId, [FromBody] AccidentDto accidentDto) { if (accidentDto == null) { return(BadRequest()); } await this.accidentService .UpdateAccidentAsync(accidentDto.ToModel()) .ConfigureAwait(false); return(Ok()); }
public async Task <IActionResult> UpdateAccident(Guid id, [FromBody] AccidentDto accident) { var updatedAccident = _mapper.Map <Accident>(accident); return(Ok(await _accidentRepository.UpdateAccident(id, updatedAccident))); }
public async Task <IActionResult> AddNewAccident([FromBody] AccidentDto newAccident) { var accident = _mapper.Map <Accident>(newAccident); return(Ok(await _accidentRepository.AddAccident(accident))); }