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