// GET: Car public ActionResult Index(string searchString, string sortOrder) { IEnumerable <Car> products = myService.GetMany().Where(w => w.Available == true && w.Active == true).ToList(); if (!String.IsNullOrEmpty(searchString)) { products = products.Where(p => p.CarModel.Name.Contains(searchString)); } switch (sortOrder) { case "bypricePerhour": products = products.OrderByDescending(s => s.PricePerHour); break; case "bypricePerday": products = products.OrderByDescending(s => s.PricePerDay); break; case "bypricePermonth": products = products.OrderByDescending(s => s.PricePerMonth); break; case "byname": products = products.OrderBy(s => s.CarModel.Name); break; default: products = products.OrderBy(s => s.MinPriceForRent); break; } return(View(products)); }
public ActionResult CarCat(int id, int?page) { int pageSize = 6; int pageNumber = (page ?? 1); var res1 = serviceCar.GetMany().Where(x => x.SubCategoryId == id && x.Active == true).ToList(); foreach (var c in res1) { ViewBag.note = serviceRating.avgRate(c); } return(View(res1.ToPagedList(pageNumber, pageSize))); }
// GET: Admin/Car public ActionResult Index() { var res = myService.GetMany().ToList(); return(View(res)); }