public async Task <IActionResult> UpdateLockStatusAsync([FromRoute] int id, bool @lock) { var report = await _repositoryManager.ReportRepository.GetAsync(id); if (report == null) { return(NotFound()); } report.Update(@lock); await _repositoryManager.SaveAsync(); return(Ok(ReportMapper.CompleteMap(report))); }
public async Task <IActionResult> UpdateAsync([FromRoute] int id, [FromBody] InReportDTO reportDTO) { var report = await _repositoryManager.ReportRepository.GetAsync(id); if (report == null) { return(NotFound()); } if (report.Locked) { return(Forbid()); } report.Update(reportDTO); await _repositoryManager.SaveAsync(); report = await _repositoryManager.ReportRepository.GetAsync(id); return(Ok(ReportMapper.CompleteMap(report))); }
public async Task <IActionResult> GetAsync([FromRoute] int carId) { var reports = await _repositoryManager.ReportRepository.GetAllAsync(carId); return(Ok(reports.Select(r => ReportMapper.CompleteMap(r)))); }