Exemplo n.º 1
0
        public IActionResult Post([FromBody] Models.Sortimat.Fm2PickAndPlace5305Batch item)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnFm2PickAndPlace5305BatchCreated(item);
                this.context.Fm2PickAndPlace5305Batches.Add(item);
                this.context.SaveChanges();

                return(Created($"odata/Sortimat/Fm2PickAndPlace5305Batches/{item.RowID}", item));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
Exemplo n.º 2
0
        public IActionResult PutFm2PickAndPlace5305Batch(int key, [FromBody] Models.Sortimat.Fm2PickAndPlace5305Batch newItem)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnFm2PickAndPlace5305BatchUpdated(newItem);
                this.context.Fm2PickAndPlace5305Batches.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.Fm2PickAndPlace5305Batches.Where(i => i.RowID == key);
                return(new ObjectResult(SingleResult.Create(itemToReturn)));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
Exemplo n.º 3
0
 partial void OnFm2PickAndPlace5305BatchUpdated(Models.Sortimat.Fm2PickAndPlace5305Batch item);