// GET: Shopping public ActionResult ShoppingList(int?page) { PAVM pavm = new PAVM(); pavm.PagedProduct = pRep.GetActives().ToPagedList(page ?? 1, 9); pavm.Categories = cRep.GetActives(); return(View(pavm)); }
public ActionResult BlogList(int?page) { PAVM pvm = new PAVM { PagedBlogs = bRep.GetActives().ToPagedList(page ?? 1, 6) }; return(View(pvm)); }
public ActionResult ProductDetail(int?id) { PAVM pavm = new PAVM() { Product = pRep.Default(x => x.ID == id), ProductAttributes = paRep.Where(x => x.ProductID == id), }; return(View(pavm)); }
// GET: Product public ActionResult Index(int?page, int?categoryID) { PAVM pavm = new PAVM() { PagedProducts = categoryID == null?pRep.GetActives().ToPagedList(page ?? 1, 9) : pRep.Where(x => x.CategoryID == categoryID).ToPagedList(page ?? 1, 9), Categories = cRep.GetActives() }; if (categoryID != null) { TempData["catID"] = categoryID; } return(View(pavm)); }
// GET: Shopping //Sayfalama işlemleri yapmak icin Pagination kütüphanesinden yararlanıyoruz(PagedList) public ActionResult ShoppingList(int?page, int?categoryID) //nullable int vermemizin sebebi buradaki int'in sayfa sayımızı temsil edecek olmasıdır...Ancak birsi direkt alısveris sayfasına ulastıgında sayfa sayısını göndermeyeceginden bu şekilde de Action'in calısabilmesini istiyoruz... { //string a = "Çağrı"; //string b = a ?? "Mehmet"; //eger a degişkeninin degeri null ise b'ye Mehmet'i at...Eger null degilse b'ye git a'nın degerini demektir... PAVM pavm = new PAVM() { PagedProducts = categoryID == null?_pRep.GetActives().ToPagedList(page ?? 1, 9) : _pRep.Where(x => x.CategoryID == categoryID).ToPagedList(page ?? 1, 9), Categories = _cRep.GetActives() }; if (categoryID != null) { TempData["catID"] = categoryID; } return(View(pavm)); }
// GET: Shopping public ActionResult ShoppingList(int?page, int?categoryID, string range) //nullable int vermemizin sebebi aslında buradaki int'in sayfa sayımızı temsil edecek olmasıdır. Ancak birisi direkt alısveriş sayfasına ulastıgında sayfa sayısını göndermeyebilir de böylece bu sekilde de Action'in calısabilmesini istiyoruz... { PAVM pavm = new PAVM(); if (range != null) { pavm.PagedProducts = categoryID == null?pRep.GetActives().Where(x => x.ProductName.ToLower().Contains(range.ToLower())).ToPagedList(page ?? 1, 9) : pRep.Where(x => x.CategoryID == categoryID && x.ProductName.ToLower().Contains(range.ToLower())).ToPagedList(page ?? 1, 9); } else { pavm.PagedProducts = categoryID == null?pRep.GetActives().ToPagedList(page ?? 1, 9) : pRep.Where(x => x.CategoryID == categoryID).ToPagedList(page ?? 1, 9); } pavm.Categories = cRep.GetActives(); if (categoryID != null) { TempData["catID"] = categoryID; } return(View(pavm)); }
public ActionResult RangeProduct(int?page, int?categoryID, string range) { PAVM pavm = new PAVM(); if (range != null) { pavm.PagedProducts = categoryID == null?pRep.GetActives().Where(x => x.ProductName.ToLower().Contains(range.ToLower())).ToPagedList(page ?? 1, 9) : pRep.Where(x => x.CategoryID == categoryID && x.ProductName.ToLower().Contains(range.ToLower())).ToPagedList(page ?? 1, 9); } else { pavm.PagedProducts = categoryID == null?pRep.GetActives().ToPagedList(page ?? 1, 9) : pRep.Where(x => x.CategoryID == categoryID).ToPagedList(page ?? 1, 9); } pavm.Categories = cRep.GetActives(); if (categoryID != null) { TempData["catID"] = categoryID; } return(View("RangeProduct", pavm)); }
// GET: Shopping //Sayfalama işlemleri yapmak icin Pagination kütüphanesinden yararlanıyoruz(PagedList) public ActionResult ShoppingList(int?page, int?categoryID) //nullable int vermemizin sebebi aslında buradaki int'in sayfa sayımızı temsil edecek olmasıdır...Ancak birisi direkt alısveriş sayfasına ulastıgında sayfa sayısını göndermeyeceginden bu sekilde de Action'in calısabilmesini istiyoruz... { //string a = "Mehmet"; //a = null; //string b = a??"Cagri"; //Eger a null ise b'ye Cagri at ... null degilse b'ye git a'nın degerini at demektir... //page??1 //Alt tarafta page?? demek page null geliyorsa demektir... PAVM pavm = new PAVM { PagedProducts = categoryID == null?_pRep.GetActives().ToPagedList(page ?? 1, 9) : _pRep.Where(x => x.CategoryID == categoryID).ToPagedList(page ?? 1, 9), Categories = _cRep.GetActives() }; if (categoryID != null) { TempData["catID"] = categoryID; } return(View(pavm)); }