public async Task <IActionResult> Index() { if (!_securityFacade.IsInRole(BlogConstants.AdministratorRoleName)) { return(RedirectToAction("Index", "WriterPanel")); } ICollection <Post> posts = await _blogUnitOfWork.Posts .GetAll() .OrderBy(post => post.PublicationDate) .ToListAsync(); ICollection <Tag> tags = await _blogUnitOfWork.Tags.GetAll().ToListAsync(); return(View(new AdminPanelViewModel() { BlogData = _blogData, Posts = posts, Tags = tags, CurrentUser = User })); }
bool UserIsAuthorized() { return(_securityFacade.IsInRole(BlogConstants.AdministratorRoleName)); }