コード例 #1
0
        public IActionResult Post([FromBody] Models.Sortimat.Sh1PickAndPlace5220Shift item)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnSh1PickAndPlace5220ShiftCreated(item);
                this.context.Sh1PickAndPlace5220Shifts.Add(item);
                this.context.SaveChanges();

                return(Created($"odata/Sortimat/Sh1PickAndPlace5220Shifts/{item.RowID}", item));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
コード例 #2
0
        public IActionResult PutSh1PickAndPlace5220Shift(int key, [FromBody] Models.Sortimat.Sh1PickAndPlace5220Shift newItem)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnSh1PickAndPlace5220ShiftUpdated(newItem);
                this.context.Sh1PickAndPlace5220Shifts.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.Sh1PickAndPlace5220Shifts.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 OnSh1PickAndPlace5220ShiftUpdated(Models.Sortimat.Sh1PickAndPlace5220Shift item);