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

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

                this.OnFm1Assembly5201PerShiftPerCycleCreated(item);
                this.context.Fm1Assembly5201PerShiftPerCycles.Add(item);
                this.context.SaveChanges();

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

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

                this.OnFm1Assembly5201PerShiftPerCycleUpdated(newItem);
                this.context.Fm1Assembly5201PerShiftPerCycles.Update(newItem);
                this.context.SaveChanges();

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