Esempio n. 1
0
        public async Task <IActionResult> Update(CategoryUpdateIdmodel categoryModel)
        {
            if (this.User.IsInRole(GlobalConstants.AdministratorRoleName))
            {
                if (ModelState.IsValid)
                {
                    var category = await this.categoryService.GetCategoryByIdAsync(categoryModel.CategoryId);

                    var neededCategory = CategoryUpdateOutputMapper.Map(category);

                    return(this.View(neededCategory));
                }
            }

            return(this.Redirect("/Identity/Account/AccessDenied"));
        }
Esempio n. 2
0
        public async Task <IActionResult> Update(int categoryId)
        {
            if (this.User.IsInRole("Administrator"))
            {
                if (true)
                {
                    var category = await this.categoryService.GetCategoryByIdAsync(categoryId);

                    var neededCategory = CategoryUpdateOutputMapper.Map(category);

                    return(this.View(neededCategory));
                }
            }

            return(this.Redirect("/Identity/Account/AccessDenied"));
        }