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