// GET: Rental/Details/5 public async Task <ActionResult> Details(string id) { RentalRepository repo = new RentalRepository(); IEnumerable <Rental> result = await repo.GetAllByRegistrationNumber(id); var viewModel = new RentalDetailsViewModel() { RegistrationNumber = id, Year = result.Select(a => a.Year).Distinct().OrderBy(a => a), AggregatedData = GetAggregatedData(result), Rentals = result }; return(View(viewModel)); }