Beispiel #1
0
        public async Task <IActionResult> Index()
        {
            var categoriesFromDb = await this.categoryService.GetAllCategoriesAsync();

            var categories = CategoryIndexMapper.Map(categoriesFromDb);

            return(this.View(categories));
        }
Beispiel #2
0
        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));
        }