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