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

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

                this.OnSh2PickAndPlace5307ShiftCreated(item);
                this.context.Sh2PickAndPlace5307Shifts.Add(item);
                this.context.SaveChanges();

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

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

                this.OnSh2PickAndPlace5307ShiftUpdated(newItem);
                this.context.Sh2PickAndPlace5307Shifts.Update(newItem);
                this.context.SaveChanges();

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