コード例 #1
0
        public ActionResult Shop()
        {
            List <SanPham> shop = SanPhamAction.ListSanPham();

            ViewBag.Shop = shop.OrderByDescending(a => a.masanpham);
            return(View());
        }
コード例 #2
0
        public ActionResult ManageProduct()
        {
            var listproduct = SanPhamAction.ListSanPham();

            ViewBag.Product = listproduct;

            return(View());
        }
コード例 #3
0
 public ActionResult ProductDetail(int productid)
 {
     using (var db = new Context())
     {
         var productdetail = SanPhamAction.FindSanPham(productid);
         var type          = db.TheLoai.Where(s => s.matl == productdetail.matl).FirstOrDefault();
         var description   = db.ChiTietSanPham.Where(s => s.masanpham == productdetail.masanpham).FirstOrDefault();
         ViewBag.Description   = description;
         ViewBag.Type          = type;
         ViewBag.ProductDetail = productdetail;
         ViewBag.ListProduct   = SanPhamAction.ListSanPham().OrderByDescending(s => s.masanpham);
         return(View());
     }
 }
コード例 #4
0
 public ActionResult Home()
 {
     using (var db = new Context())
     {
         int accountid = Convert.ToInt32(Session["id"]);
         var feature   = db.ChiTietGioHang.Where(s => s.makh == accountid).ToList();
         int quantity  = 0;
         foreach (var a in feature)
         {
             quantity = quantity + a.soluong;
         }
         if (quantity != 0)
         {
             Session["QuantityCart"] = quantity;
         }
         else
         {
             Session["QuantityCart"] = 0;
         }
         ViewBag.Home = SanPhamAction.ListSanPham();
         return(View());
     }
 }