public IActionResult SchoolsList() { var viewModel = new SchoolsListViewModel { Schools = _schoolsServices.GetAll <SchoolViewModel>() }; return(View(viewModel)); }
public async Task <IActionResult> Index() { var viewModel = new IndexViewModel(); if (_signInManager.IsSignedIn(User)) { var user = await _userManager.GetUserAsync(User); viewModel.Username = user?.UserName; var isAdmin = await IsCurrentUserAdmin(); if (isAdmin) { viewModel.Schools = _schoolsServices.GetAll <SchoolViewModel>(); } else { viewModel.Schools = _schoolsServices.GetAllByUserId <SchoolViewModel>(user?.UniqueGradebookId); } } return(View(viewModel)); }