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

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

                this.OnFm1PickAndPlace5219PerBatchPerCycleCreated(item);
                this.context.Fm1PickAndPlace5219PerBatchPerCycles.Add(item);
                this.context.SaveChanges();

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

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

                this.OnFm1PickAndPlace5219PerBatchPerCycleUpdated(newItem);
                this.context.Fm1PickAndPlace5219PerBatchPerCycles.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.Fm1PickAndPlace5219PerBatchPerCycles.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 OnFm1PickAndPlace5219PerBatchPerCycleUpdated(Models.Sortimat.Fm1PickAndPlace5219PerBatchPerCycle item);