public JsonResult  GetOrderDeatail()
        {
            var data = OrderDetailModel.GetOrderData();

            return(new JsonResult {
                Data = data, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #2
0
        public ActionResult CheckOut()
        {
            using (FoodOrderDbContext db = new FoodOrderDbContext())
            {
                if (Session["UserId"] != null)
                {
                    int     id           = Convert.ToInt32(Session["UserId"].ToString());
                    var     totalRecords = db.Orders.Where(s => s.userId == id).ToList();
                    decimal totalAmount  = 0;
                    foreach (var item in totalRecords)
                    {
                        totalAmount += Convert.ToDecimal(item.totalPrice);
                    }
                    ViewBag.Amount = totalAmount;

                    return(View(OrderDetailModel.GetOrderData(id)));
                }
                return(RedirectToAction("Index", "Home"));
            }
        }