示例#1
0
        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)));
        }
示例#2
0
        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)));
        }
示例#3
0
        public async Task <IActionResult> GetAsync([FromRoute] int carId)
        {
            var reports = await _repositoryManager.ReportRepository.GetAllAsync(carId);

            return(Ok(reports.Select(r => ReportMapper.CompleteMap(r))));
        }