public List<SanPham> spnew() { SanPhamController ctrl = new SanPhamController(); List<SanPham> listnew = ctrl.timkiem("", "", "", "", -1, -1, null, null, "1", "id", true, 0, 6); if (listnew != null) { //foreach (var item in listnew) //{ // item.mota = sub(item.mota); //} return listnew; } return new List<SanPham>(); }
// // GET: /FrontSanPhamDetail/ public ActionResult Index(int id=0) { ViewBag.id = 2; SanPhamController ctr = new SanPhamController(); SanPham sp = new SanPham(); sp=ctr.get_by_id(id); if (sp != null&&sp.active==true) { ViewBag.Title = sp.ten; ViewBag.SanPhamDetail = sp; List<NhomSanPham> a = new List<NhomSanPham>(); a.Add(sp.nhomsanpham); List<SanPham> SanPhamRelate = ctr.timkiem("", "", "", "", -1, -1, null, a, "1", "id", true, 0, 3); if (SanPhamRelate != null) ViewBag.SanPhamRelate = SanPhamRelate; else ViewBag.SanPhamRelate = new List<SanPham>(); return View(); } else return View("Error"); }
public ActionResult Index(int page=1) { //check if (!this._nhanvien_permission.Contains("sanpham_view")) { return this._fail_permission("sanpham_view"); } SanPhamController ctr = new SanPhamController(); NhomSanPhamController ctr_nhom = new NhomSanPhamController(); HangSXController ctr_hangsx = new HangSXController(); List<HangSX> hangsx_list = ctr_hangsx.timkiem(timkiem_sanpham["hangsx_id"]); NhomSanPham nhom_obj = ctr_nhom.get_by_id(TextLibrary.ToInt(timkiem_sanpham["nhomsanpham_id"])); List<NhomSanPham> nhomsanpham_list = ctr_nhom.get_tree2(nhom_obj); //pagination int max_item_per_page = TextLibrary.ToInt(this.timkiem_sanpham["max_item_per_page"]); Pagination pg = new Pagination(); pg.set_current_page(page); pg.set_max_item_per_page(max_item_per_page); pg.set_total_item( ctr.timkiem_count( timkiem_sanpham["id"], timkiem_sanpham["masp"], timkiem_sanpham["ten"], "", TextLibrary.ToInt(timkiem_sanpham["gia_from"]), TextLibrary.ToInt(timkiem_sanpham["gia_to"]), hangsx_list, nhomsanpham_list, timkiem_sanpham["active"] ) ); pg.update(); //Chọn danh sách nhân viên để hiển thị theo cookies tìm kiếm ViewBag.SanPham_List = ctr.timkiem( timkiem_sanpham["id"], timkiem_sanpham["masp"], timkiem_sanpham["ten"], "", TextLibrary.ToInt( timkiem_sanpham["gia_from"]), TextLibrary.ToInt(timkiem_sanpham["gia_to"]), hangsx_list, nhomsanpham_list, timkiem_sanpham["active"], timkiem_sanpham["order_by"], TextLibrary.ToBoolean(timkiem_sanpham["order_desc"]), pg.start_point, max_item_per_page ); //set search cookies ViewBag.timkiem_sanpham = this.timkiem_sanpham; ViewBag.Title += " - Quản lý"; ViewBag.pagination = pg; ViewBag.NhomSanPham2_List = ctr_nhom.timkiem(); ViewBag.HangSX_List = ctr_hangsx.timkiem(); return View(); }