public async Task <HttpResponseMessage> Update([FromUri] int id, [FromBody] EditIncidentModel model) { Log.Out.BeginInfo(model.ToJson(), "UpdateIncident Id: {0}", id); await Service.Get <IManagementSevice>().UpdateIncident(id, model); Log.Out.EndInfo("UpdateIncident Id: {0}", id); return(Request.CreateResponse(HttpStatusCode.OK)); }
public async Task <HttpResponseMessage> Add([FromBody] EditIncidentModel model) { Log.Out.BeginInfo(model.ToJson(), "AddIncident"); var id = await Service.Get <IManagementSevice>().AddIncident(model); Log.Out.EndInfo("AddIncident Id: {0}", id); return(Request.CreateResponse(HttpStatusCode.OK, new { Id = id })); }
public Task UpdateIncident(int id, EditIncidentModel model) { return(Update <Incident, IIncidentRepository>(id, entity => { var updatedEntity = model.GetEntity(); entity.Name = updatedEntity.Name; entity.Address = updatedEntity.Address; entity.Lat = updatedEntity.Lat; entity.Lng = updatedEntity.Lng; entity.Type = updatedEntity.Type; entity.Priority = updatedEntity.Priority; entity.FacilityType = updatedEntity.FacilityType; entity.Duration = updatedEntity.Duration; entity.Description = updatedEntity.Description; })); }
public Task <int> AddIncident(EditIncidentModel model) { return(Add <Incident, IIncidentRepository>(entity => entity.Id, model.GetEntity)); }