Ejemplo n.º 1
0
        public async Task <ActionResult> DetailsByYear(string id, int year)
        {
            RentalRepository     repo   = new RentalRepository();
            IEnumerable <Rental> result = await repo.GetAllByRegistrationNumberAndYear(id, year);

            var viewModel = new RentalDetailsYearViewModel()
            {
                RegistrationNumber = id,
                Month          = result.Select(a => a.Month).Distinct().OrderBy(a => a).ToDictionary(c => c, c => CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(c)),
                Year           = year,
                AggregatedData = GetAggregatedData(result),
                Rentals        = result
            };

            return(View(viewModel));
        }