public ActionResult Shop() { List <SanPham> shop = SanPhamAction.ListSanPham(); ViewBag.Shop = shop.OrderByDescending(a => a.masanpham); return(View()); }
public ActionResult ManageProduct() { var listproduct = SanPhamAction.ListSanPham(); ViewBag.Product = listproduct; return(View()); }
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()); } }
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()); } }