public IActionResult Post([FromBody] Models.Sortimat.Fm1AssemblyReportHourShift item) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (item == null) { return(BadRequest()); } this.OnFm1AssemblyReportHourShiftCreated(item); this.context.Fm1AssemblyReportHourShifts.Add(item); this.context.SaveChanges(); return(Created($"odata/Sortimat/Fm1AssemblyReportHourShifts/{item.RowID}", item)); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(BadRequest(ModelState)); } }
public IActionResult PutFm1AssemblyReportHourShift(int key, [FromBody] Models.Sortimat.Fm1AssemblyReportHourShift newItem) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (newItem == null || (newItem.RowID != key)) { return(BadRequest()); } this.OnFm1AssemblyReportHourShiftUpdated(newItem); this.context.Fm1AssemblyReportHourShifts.Update(newItem); this.context.SaveChanges(); var itemToReturn = this.context.Fm1AssemblyReportHourShifts.Where(i => i.RowID == key); return(new ObjectResult(SingleResult.Create(itemToReturn))); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(BadRequest(ModelState)); } }
partial void OnFm1AssemblyReportHourShiftUpdated(Models.Sortimat.Fm1AssemblyReportHourShift item);