Example #1
0
        public IActionResult Post([FromBody] Models.Sortimat.Sh1PickAndPlace5220PerShiftPerCycle item)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                if (item == null)
                {
                    return(BadRequest());
                }

                this.OnSh1PickAndPlace5220PerShiftPerCycleCreated(item);
                this.context.Sh1PickAndPlace5220PerShiftPerCycles.Add(item);
                this.context.SaveChanges();

                return(Created($"odata/Sortimat/Sh1PickAndPlace5220PerShiftPerCycles/{item.RowID}", item));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
Example #2
0
        public IActionResult PutSh1PickAndPlace5220PerShiftPerCycle(int key, [FromBody] Models.Sortimat.Sh1PickAndPlace5220PerShiftPerCycle newItem)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                if (newItem == null || (newItem.RowID != key))
                {
                    return(BadRequest());
                }

                this.OnSh1PickAndPlace5220PerShiftPerCycleUpdated(newItem);
                this.context.Sh1PickAndPlace5220PerShiftPerCycles.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.Sh1PickAndPlace5220PerShiftPerCycles.Where(i => i.RowID == key);
                return(new ObjectResult(SingleResult.Create(itemToReturn)));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
Example #3
0
 partial void OnSh1PickAndPlace5220PerShiftPerCycleUpdated(Models.Sortimat.Sh1PickAndPlace5220PerShiftPerCycle item);