public async Task <IActionResult> Put(int id, [FromBody] IncidentPutRp model) { if (!this.ModelState.IsValid) { return(this.BadRequest(this.ModelState)); } var result = await this._incidentComponent.Put(id, model); return(this.Ok(result)); }
public async Task <IncidentGetListRp> Put(int id, IncidentPutRp model) { var createdBy = this._identityGateway.GetIdentity(); var incident = await this._dbContext.Incidents.Where(c => c.Id == id).SingleAsync(); this._dbContext.ChangeTracker.AutoDetectChangesEnabled = true; incident.Update(model.Title, createdBy, this._datetimeGateway.GetCurrentDateTime(), model.End, model.TTD, model.TTE, model.TTF, model.URL); this._dbContext.Incidents.Update(incident); await this._dbContext.SaveChangesAsync(); return(this._mapper.Map <IncidentGetListRp>(incident)); }