Esempio n. 1
0
        public async Task <ActionResult> SendOrder(int id)
        {
            var order = db.Orders.Single(ord => ord.OrderID == id);

            foreach (var prodOrd in db.ProdOrder.Where(PrOd => PrOd.OrderID == order.OrderID))
            {
                db.Products.Single(prod => prod.ProductID == prodOrd.ProductID).NrInStore -= 1;
                //await db.SaveChangesAsync();
            }
            db.Orders.Single(ord => ord.OrderID == id).OrderSent = true;
            await db.SaveChangesAsync();

            return(View("index", await GetOrders()));
        }