Exemplo n.º 1
0
        public IActionResult SchoolsList()
        {
            var viewModel = new SchoolsListViewModel
            {
                Schools = _schoolsServices.GetAll <SchoolViewModel>()
            };

            return(View(viewModel));
        }
Exemplo n.º 2
0
        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));
        }