public async Task <Models.SqlExpress.OrderDetail> CancelOrderDetailChanges(Models.SqlExpress.OrderDetail item)
        {
            var entityToCancel = Context.Entry(item);

            entityToCancel.CurrentValues.SetValues(entityToCancel.OriginalValues);
            entityToCancel.State = EntityState.Unchanged;

            return(item);
        }
        public async Task <Models.SqlExpress.OrderDetail> CreateOrderDetail(Models.SqlExpress.OrderDetail orderDetail)
        {
            OnOrderDetailCreated(orderDetail);

            Context.OrderDetails.Add(orderDetail);
            Context.SaveChanges();

            OnAfterOrderDetailCreated(orderDetail);

            return(orderDetail);
        }
        public async Task <Models.SqlExpress.OrderDetail> UpdateOrderDetail(int?id, Models.SqlExpress.OrderDetail orderDetail)
        {
            OnOrderDetailUpdated(orderDetail);

            var itemToUpdate = Context.OrderDetails
                               .Where(i => i.Id == id)
                               .FirstOrDefault();

            if (itemToUpdate == null)
            {
                throw new Exception("Item no longer available");
            }
            var entryToUpdate = Context.Entry(itemToUpdate);

            entryToUpdate.CurrentValues.SetValues(orderDetail);
            entryToUpdate.State = EntityState.Modified;
            Context.SaveChanges();

            OnAfterOrderDetailUpdated(orderDetail);

            return(orderDetail);
        }
 partial void OnAfterOrderDetailUpdated(Models.SqlExpress.OrderDetail item);
 partial void OnOrderDetailGet(Models.SqlExpress.OrderDetail item);
 partial void OnOrderDetailDeleted(Models.SqlExpress.OrderDetail item);