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

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

                this.OnFm2Assembly5306BatchCreated(item);
                this.context.Fm2Assembly5306Batches.Add(item);
                this.context.SaveChanges();

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

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

                this.OnFm2Assembly5306BatchUpdated(newItem);
                this.context.Fm2Assembly5306Batches.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.Fm2Assembly5306Batches.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 OnFm2Assembly5306BatchUpdated(Models.Sortimat.Fm2Assembly5306Batch item);