Пример #1
0
        public IActionResult Post([FromBody] Models.Sortimat.Fm1PickAndPlace5219Datum item)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnFm1PickAndPlace5219DatumCreated(item);
                this.context.Fm1PickAndPlace5219Data.Add(item);
                this.context.SaveChanges();

                return(Created($"odata/Sortimat/Fm1PickAndPlace5219Data/{item.id}", item));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
Пример #2
0
        public IActionResult PutFm1PickAndPlace5219Datum(int key, [FromBody] Models.Sortimat.Fm1PickAndPlace5219Datum newItem)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnFm1PickAndPlace5219DatumUpdated(newItem);
                this.context.Fm1PickAndPlace5219Data.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.Fm1PickAndPlace5219Data.Where(i => i.id == key);
                return(new ObjectResult(SingleResult.Create(itemToReturn)));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
Пример #3
0
 partial void OnFm1PickAndPlace5219DatumUpdated(Models.Sortimat.Fm1PickAndPlace5219Datum item);