Exemplo n.º 1
0
        //public IActionResult Faculty(string statusCode)
        //{
        //    ViewBag.StatusCodes = _repository.GetStatusCodes();
        //    var vm = new List<FacultyProfileViewModel>();
        //    var faculty = new List<User>();

        //    if(statusCode == null)
        //    {
        //        statusCode = "Active";
        //    }

        //    if (statusCode == "All")
        //    {
        //        faculty = _repository.GetAllFaculty();
        //        foreach(var f in faculty)
        //        {
        //            var temp = Mapper.Map<FacultyProfileViewModel>(f);
        //            vm.Add(temp);
        //        }
        //        return View(vm);
        //    }
        //    else
        //    {
        //        faculty = _repository.GetAllFaculty(statusCode);
        //        foreach (var f in faculty)
        //        {
        //            var temp = Mapper.Map<FacultyProfileViewModel>(f);
        //            vm.Add(temp);
        //        }
        //        return View(vm);
        //    }
        //}

        public async Task <IActionResult> Admins()
        {
            var admins = _repository.GetAllAdmins();
            var vm     = new List <AdminProfileViewModel>();

            if (admins != null)
            {
                foreach (var a in admins)
                {
                    vm.Add(new AdminProfileViewModel()
                    {
                        Id = a.Id, FirstName = a.FirstName, LastName = a.LastName, SuperAdmin = await _userManager.IsInRoleAsync(a, "SuperAdmin")
                    });
                }
                return(View(vm));
            }
            ModelState.AddModelError("", "There was a problem retrieving the admins list");
            return(View(new List <AdminProfileViewModel>()));
        }