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

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

                this.OnFm1PickAndPlace5219ShiftCreated(item);
                this.context.Fm1PickAndPlace5219Shifts.Add(item);
                this.context.SaveChanges();

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

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

                this.OnFm1PickAndPlace5219ShiftUpdated(newItem);
                this.context.Fm1PickAndPlace5219Shifts.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.Fm1PickAndPlace5219Shifts.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 OnFm1PickAndPlace5219ShiftUpdated(Models.Sortimat.Fm1PickAndPlace5219Shift item);