public void PostReportStatus([FromBody] Models.Presentation.ReportStatusChangeModel statusInfo) { Models.IncidentReport report = this._db.IncidentReports.Where(r => r.incidentId == statusInfo.incidentId).SingleOrDefault(); if (report != null) { report.statusId = statusInfo.statusId; report.currentUser = statusInfo.currentUser; report.lastModified = statusInfo.lastModified; report.lastModifiedBy = statusInfo.lastModifiedBy; this._db.IncidentReports.Attach(report); this._db.Entry(report).State = System.Data.Entity.EntityState.Modified; this._db.SaveChanges(); } }
public void LockReport([FromBody] Models.Presentation.ReportStatusChangeModel reportStatus) { var report = this._db.IncidentReports.Where(r => r.incidentId == reportStatus.incidentId).SingleOrDefault(); if (report != null) { report.statusId = 5; // Under Aministrative Review report.currentUser = reportStatus.currentUser; report.lastModifiedBy = reportStatus.lastModifiedBy; report.lastModified = DateTime.Now; this._db.IncidentReports.Attach(report); this._db.Entry(report).State = System.Data.Entity.EntityState.Modified; this._db.SaveChanges(); } else { throw new Exception("Report could not be found."); } }