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