// GET: Products public ActionResult Index() { IserviceProduct ip = new serviceProduct(); List <Product> lp = new List <Product>(); lp = ip.listprod(); return(View(lp)); }
// GET: Products public ActionResult Index() { IserviceProduct ip = new serviceProduct(); List <Product> lp = new List <Product>(); lp = ip.listprod(); lp.Reverse(); ViewBag.pagenb = lp.Count / 12; return(View(lp)); }
public ActionResult Index(string search, string type, string btPage) {//this method maymeshaa haad w manajemch nfasarha li yheb yefhemha nfahemhelou ki net9ablou IserviceProduct ip = new serviceProduct(); List <Product> lp = new List <Product>(); if (type != null) { string ch = search; //valeur à chercher string ch1 = type; //type de trie lp = ip.search_kw(search).Where(a => a.qteprod > 0).ToList(); if (!type.Equals("desc")) { lp.Reverse(); order = true; } else { order = false; } } else { int page = Int32.Parse(btPage); lp = ip.listprod(); if (order) { lp.Reverse(); lp = lp.Skip((page - 1) * 12).ToList(); } else { lp = lp.Skip((page - 1) * 12).ToList(); } } ViewBag.pagenb = ip.listprod().Count / 12; return(View(lp)); }