Ejemplo n.º 1
0
        public ActionResult ViewCart()
        {
            ViewBag.BookTop = BookAction.AddSachTop5ToDb();
            if (TempData["Alert"] != null)
            {
                ViewBag.Alert = TempData["Alert"].ToString();
            }
            if (Session["UserName"] != null && (int)Session["Role"] == 2)
            {
                int AccountId = (int)Session["UserID"];
                if (Session["UserID"] == null)
                {
                    return(RedirectToAction("Login", "Account"));
                }
                var listCart = BillAction.ListCartDetail(AccountId);

                if (listCart != null)
                {
                    ViewBag.ListCart = listCart;
                    ViewBag.Detail   = listCart.FirstOrDefault();
                }
                return(View());
            }
            return(RedirectToAction("Login", "Account"));
        }