public GioHangViewModels(int ID, string IDLoaiSanPham) { this.ID = ID; this.IDLoaiSanPham = IDLoaiSanPham; if (IDLoaiSanPham == "Phone") { Phone phone = PhoneBLL.GetSinglePhone(ID, IDLoaiSanPham); TenSanPham = phone.TenSanPham; HinhAnh = phone.HinhAnhSanPham; DonGia = phone.GiaSanPham; } else if (IDLoaiSanPham == "Laptop") { Laptop laptop = LaptopBLL.GetSingleLaptop(ID, IDLoaiSanPham); TenSanPham = laptop.TenSanPham; HinhAnh = laptop.HinhAnhSanPham; DonGia = laptop.GiaSanPham; } else { Tablet tablet = TabletBLL.GetSingleTablet(ID, IDLoaiSanPham); TenSanPham = tablet.TenSanPham; HinhAnh = tablet.HinhAnhSanPham; DonGia = tablet.GiaSanPham; } }
public ViewResult ChiTietPhone(int ID) { var phone = PhoneBLL.GetSinglePhone(ID); if (phone == null) { Response.StatusCode = 404; return(null); } return(View(phone)); }
public ActionResult Details(int ID) { return(View(PhoneBLL.GetSinglePhone(ID))); }