Example #1
0
        public async Task <EmailFormViewModel> GetEmailForm()
        {
            var year = _globalConfigs.YearValue;

            return(new EmailFormViewModel
            {
                AdminCount = ApiConstants.AdminEmail.Length,
                StudentCount = (await _studentLogic.GetAll(year)).Count(),
                DriverCount = (await _driverLogic.GetAll(year)).Count(),
                HostCount = (await _hostLogic.GetAll(year)).Count(),
                UserCount = (await _userLogic.GetAll(year)).Count()
            });
        }
        /// <summary>
        /// Returns the status of mappings
        /// </summary>
        /// <returns></returns>
        public async Task <DriverHostMappingViewModel> MappingStatus()
        {
            var hosts   = (await _hostLogic.GetAll()).ToList();
            var drivers = (await _driverLogic.GetAll()).Where(x => x.Role == RolesEnum.Driver).ToList();

            // TODO: add check to return only students that are present
            return(new DriverHostMappingViewModel
            {
                AvailableHosts = hosts,
                AvailableDrivers = drivers.Where(x => x.Host == null),
                MappedDrivers = drivers.Where(x => x.Host != null),
                MappedHosts = hosts.Where(x => x.Drivers != null && x.Drivers.Any())
            });
        }
 public async Task <IActionResult> Index()
 {
     return(View(await _hostLogic.GetAll()));
 }