public async Task <IActionResult> Index() { var categoriesFromDb = await this.categoryService.GetAllCategoriesAsync(); var categories = CategoryIndexMapper.Map(categoriesFromDb); return(this.View(categories)); }
public async Task <IActionResult> Index() { if (!this.User.IsInRole(GlobalConstants.AdministratorRoleName)) { return(this.Redirect("/Identity/Account/AccessDenied")); } var categoriesFromDb = await this.categoryService.GetAllCategoriesAsync(); var categories = CategoryIndexMapper.Map(categoriesFromDb); return(this.View(categories)); }