public ActionResult Index() { if (ListAllProduct == null) { ListAllProduct = CommonFile.GetProduct(); } var PopularProducts = CommonFile.GetPopularProduct(0); ViewBag.PopularProducts = PopularProducts; ViewBag.FirstCategory = PopularProducts.Where(x => x.ParentCatId == long.Parse((Constant.ParentCategories[0]).ToString())).Take(Constant.NumberOfProductsInFrontPage); ViewBag.SecondCategory = PopularProducts.Where(x => x.ParentCatId == Constant.ParentCategories[1]).Take(Constant.NumberOfProductsInFrontPage); ViewBag.ThirdCategory = PopularProducts.Where(x => x.ParentCatId == Constant.ParentCategories[2]).Take(Constant.NumberOfProductsInFrontPage); ViewBag.FourthCategory = PopularProducts.Where(x => x.ParentCatId == Constant.ParentCategories[3]).Take(Constant.NumberOfProductsInFrontPage); ViewBag.FifthCategory = PopularProducts.Where(x => x.ParentCatId == Constant.ParentCategories[4]).Take(Constant.NumberOfProductsInFrontPage); ViewBag.ProductCatList = CommonFile.GetProductCategory(null); return View(); }