コード例 #1
0
        public IActionResult Post([FromBody] Models.Sortimat.Fm2Assembly5306Shift item)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnFm2Assembly5306ShiftCreated(item);
                this.context.Fm2Assembly5306Shifts.Add(item);
                this.context.SaveChanges();

                return(Created($"odata/Sortimat/Fm2Assembly5306Shifts/{item.RowID}", item));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
コード例 #2
0
        public IActionResult PutFm2Assembly5306Shift(int key, [FromBody] Models.Sortimat.Fm2Assembly5306Shift newItem)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnFm2Assembly5306ShiftUpdated(newItem);
                this.context.Fm2Assembly5306Shifts.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.Fm2Assembly5306Shifts.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 OnFm2Assembly5306ShiftUpdated(Models.Sortimat.Fm2Assembly5306Shift item);