public ActionResult Index()
        {
            var vehicles = Using <GetVehicleListForUser>()
                           .Execute(CurrentUserId)
                           .ToList();

            var imminentReminders = Using <GetImminentRemindersForUser>()
                                    .Execute(CurrentUserId, DateTime.UtcNow);

            foreach (var vehicle in vehicles)
            {
                vehicle.HasImminentReminders = imminentReminders
                                               .Any(i => i.VehicleId == vehicle.VehicleId);
            }

            var statistics = Using <GetFleetSummaryStatistics>()
                             .Execute(CurrentUserId);

            var model = new DashboardViewModel
            {
                User = CurrentUser,
                VehicleListViewModel   = new VehicleListViewModel(vehicles),
                ImminentReminders      = imminentReminders,
                FleetSummaryStatistics = new StatisticsViewModel(statistics)
            };

            // The country list is placed in the viewbag solely to support
            // the legacy desktop version of the application.
            ViewBag.CountryList = getCountries.GetCountrySelectList();

            return(new ContentTypeAwareResult(model));
        }
Beispiel #2
0
        private ActionResult SetupProfileForm(User user)
        {
            ViewBag.CountryList = _getCountries.GetCountrySelectList();

            return(new ContentTypeAwareResult(user));
        }