public IActionResult PutOrder(int key, [FromBody] Models.Sample.Order newItem)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnOrderUpdated(newItem);
                this.context.Orders.Update(newItem);
                this.context.SaveChanges();

                return(new NoContentResult());
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
        public IActionResult Post([FromBody] Models.Sample.Order item)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnOrderCreated(item);
                this.context.Orders.Add(item);
                this.context.SaveChanges();

                return(Created($"odata/Sample/Orders/{item.Id}", item));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
        public IActionResult PutOrder(int key, [FromBody] Models.Sample.Order newItem)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnOrderUpdated(newItem);
                this.context.Orders.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.Orders.Where(i => i.Id == key);
                return(new ObjectResult(SingleResult.Create(itemToReturn)));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
 partial void OnOrderUpdated(Models.Sample.Order item);
 partial void OnOrderDeleted(Models.Sample.Order item);