public Contracts.Incident.Incident Update(Contracts.Incident.UpdateIncident updateIncident) { using (var db = new RAAPEntities(GetConnectionString())) { var process = db.Incidents.FirstOrDefault(a => a.IncidentId == updateIncident.IncidentId); if (process == null) { throw new RAAPNotFoundException("Item not found."); } process.ApplyUpdate(updateIncident); db.SaveChanges(); return(process.ToContract()); } }
public static void ApplyUpdate(this Incident dataItem, Contracts.Incident.UpdateIncident update) { dataItem.Name = update.Name; dataItem.Description = update.Description; dataItem.UpdatedOn = DateTime.Now; }