public PartialViewResult ListProduct(int?page) { int pageCurrent = 1; if (page.HasValue) { pageCurrent = page.Value; } shProductService _product = new shProductService(); IPagedList <shProduct> dsProduct = _product.DanhSachProduct().Where(x => x.TopHot != true).ToPagedList(pageCurrent, Config.PAGE_SIZE_10); ViewBag.ListProduct = dsProduct; return(PartialView("ListProduct", dsProduct)); }
public PartialViewResult ListComment(int?page) { int pageCurrent = 1; if (page.HasValue) { pageCurrent = page.Value; } shProductService _product = new shProductService(); IEnumerable <shProduct> dsProduct = _product.DanhSachProduct(); shCommentService _comment = new shCommentService(); IEnumerable <string> dsComment_Product = _comment.DanhSachComment(true).Select(x => x.ProductGuid).Distinct(); dsProduct = dsProduct.Join(dsComment_Product, x => x.ProductGuid, comment => comment, (x, ProductGuid) => x); ViewBag.dsProduct = dsProduct.ToPagedList(pageCurrent, Config.PAGE_SIZE_20); return(PartialView("ListComment", ViewBag.dsProduct)); }
public static int?FindPageProduct(string ProductGuid, int ProductId, int PageSize) { try { int page = 1; shProductService _product = new shProductService(); List <shProduct> dsProduct = _product.DanhSachProduct().ToList(); page = dsProduct.FindIndex(x => x.ProductGuid == ProductGuid); page = (int)page / PageSize; page++; return(page); } catch (Exception) { return(1); } }