public IViewComponentResult Invoke() { ViewBag.SelectedGrade = RouteData?.Values["category"]; return(View(repo.GetAll() .Select(x => x.Grade.GradeType.ToString()) .Distinct() .OrderBy(x => x))); }
public ViewResult CarsList(string category, int carPage = 1) => View(new CarListView { Cars = repository.getCarByGrade(repository.GetAll(), category) .Include(c => c.Grade) .OrderBy(p => p.Car_ID) .Skip((carPage - 1) * PageSize) .Take(PageSize), PagingInfo = new PagingInfo { CurrentPage = carPage, ItemsPerPage = PageSize, TotalItems = category == null ? repository.GetAll().Count() : repository.getCarByGrade(repository.GetAll(), category).Count() }, CurrentCategory = category });
List <SelectListItem> SelectListItemsCar(EditCarDetalisView vm) { var carList = repoCar.GetAll().ToList(); var carListSelected = new List <SelectListItem>(); foreach (var item in carList) { string id = item.Car_ID.ToString(); string carText = item.ToString(); carListSelected.Add(new SelectListItem { Text = carText, Value = id }); } return(carListSelected); }
public IActionResult Index() => View(_repo.GetAll());