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

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

                this.OnFm2PickAndPlace5305ShiftCreated(item);
                this.context.Fm2PickAndPlace5305Shifts.Add(item);
                this.context.SaveChanges();

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

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

                this.OnFm2PickAndPlace5305ShiftUpdated(newItem);
                this.context.Fm2PickAndPlace5305Shifts.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.Fm2PickAndPlace5305Shifts.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 OnFm2PickAndPlace5305ShiftUpdated(Models.Sortimat.Fm2PickAndPlace5305Shift item);