public async Task <IActionResult> PutAsync(UpdateReportModel report) { _logger.LogInformation($"Updating report [{report.Id}]..."); await _service.UpdateReportAsync( _mapper.Map <DAL.Entities.Report>(report)); return(NoContent()); }
public async Task <ActionResult> UpdateReport([FromBody] UpdateReportModel updateReport) { try { await _reportService.UpdateReportAsync(updateReport, UserId); await PushFilesToDrive(updateReport.Name, updateReport.ReportTypeId, updateReport.Values, updateReport.DriveType); Report report = _reportService.GetReport(updateReport.ReportId); return(Ok(report)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public void UpdateReport(UpdateReportModel updateReport, Guid userId) { try { ReportHistory reportHistory = new ReportHistory { ReportId = updateReport.ReportId, CreateUserId = userId, CreateDate = DateTime.Now }; _docFlowContext.ReportHistory.Add(reportHistory); List <ReportValue> reportValues = GetReportValues(updateReport.ReportId); foreach (ReportValue reportValue in reportValues) { ReportLabelModel reportLabelModel = updateReport.Values.FirstOrDefault(x => x.Id == reportValue.ReportLabelId); _docFlowContext.ReportValuesHistory.Add(new ReportValuesHistory { ReportValueId = reportValue.Id, ReportHistoryId = reportHistory.Id, OldValue = reportValue.Value, NewValue = reportLabelModel.Value }); reportValue.Value = reportLabelModel.Value; } _docFlowContext.SaveChanges(); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public Task UpdateReportAsync(UpdateReportModel report) { return(_clientFactory.CreateClient().PutAsync(report)); }