public ActionResult GetProductPage(int page) { if (User.Identity.IsAuthenticated) { UserProfile user = UserProfiles_Logic.GetUserProfileByUserName(User.Identity.Name); List <ProductDisplay> list = Product_Logic.GetListProductCateforyFollow(user.UserId, page, Constant.PAGE_SIZE); return(Json(list, JsonRequestBehavior.AllowGet)); } else { return(Json(null)); } }
// // GET: /Product/Details/5 public ActionResult Details(int id = 0) { Product product = db.Products.Find(id); if (product == null) { return(HttpNotFound()); } Store store = product.Store; if (product.StatusId == Constant.STATUS_BANNED || product.StatusId == Constant.STATUS_INACTIVE || store.StatusId == Constant.STATUS_BANNED || store.StatusId == Constant.STATUS_INACTIVE) { ViewBag.Message = "Sorry, this product is not available."; return(View("Error")); } if (store.StatusId == Constant.STATUS_PENDING) { ViewBag.Message = "Sorry, The store of product is pending."; return(View("Error")); } if (User.Identity.IsAuthenticated != false) { UserProfile user = UserProfiles_Logic.GetUserProfileByUserName(User.Identity.Name); ViewBag.detailuser = user; } else { ViewBag.detailuser = null; } // List product recommend List <Product> listrecommend = Product_Logic.GetListProdcutRecommend(id, 4); ViewBag.listrecommend = listrecommend; // List user like product List <UserProfile> listlike = Product_Logic.GetListUserProfileRandom(1, id, 5, WebSecurity.IsAuthenticated ? WebSecurity.CurrentUserId : 0); ViewBag.listlike = listlike; // List user buy product List <UserProfile> listbuy = Product_Logic.GetListUserProfileRandom(2, id, 5, WebSecurity.IsAuthenticated ? WebSecurity.CurrentUserId : 0); ViewBag.listbuy = listbuy; // List comment product List <Comment> listcmt = Comment_Logic.GetListCommentByProductID(id); ViewBag.listcmt = listcmt; return(View(product)); }
public ActionResult Index() { if (User.Identity.IsAuthenticated) { UserProfile user = UserProfiles_Logic.GetUserProfileByUserName(User.Identity.Name); ViewBag.totalrow = Product_Logic.GetTotalRowListProductCateforyFollow(user.UserId); ViewBag.listpro = Product_Logic.GetListProductCateforyFollow(user.UserId, 1, Constant.PAGE_SIZE); } else { ViewBag.totalrow = 0; ViewBag.listpro = null; } ViewBag.EditorPicks = db.EditorPicks.ToList(); var products = db.Products.OrderByDescending(p => p.CreateDate).ToList(); return(View(products)); }
public ActionResult Category(int ID) { if (ID <= 0) { ViewBag.Message = "Sorry, you must provide a valid Category Id."; return(View("Error")); } Category Category = db.Categories.Find(ID); if (Category == null) { ViewBag.Message = "Sorry, we can't find the category or you're not the owner."; return(View("Error")); } List <ProductDisplay> list = Product_Logic.GetListProdcutByCategoryID(ID, 1, Constant.PAGE_SIZE); ViewBag.Category = Category; ViewBag.TotalRow = Product_Logic.GetTotalRowsProdcutByCategoryID(ID); return(View(list)); }
public ActionResult GetProductPage(int ID, int page) { List <ProductDisplay> list = Product_Logic.GetListProdcutByCategoryID(ID, page, Constant.PAGE_SIZE); return(Json(list, JsonRequestBehavior.AllowGet)); }