public virtual IActionResult Create()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCategories))
            {
                return(AccessDeniedView());
            }

            //prepare model
            var model = _categoryModelFactory.PrepareCategoryModel(new CategoryModel(), null);

            return(View(model));
        }
예제 #2
0
        public virtual IActionResult Create()
        {
            bool isAuthorized = _authorizationService.AuthorizeAsync(User, GetCurrentUserAsync(), CustomerOperations.Create).Result.Succeeded;

            if (!isAuthorized)
            {
                return(AccessDeniedView());
            }

            //prepare model
            CategoryModel model = _categoryModelFactory.PrepareCategoryModel(new CategoryModel(), null);

            return(View(model));
        }
예제 #3
0
        public IActionResult EditCategory(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var category = _categoryService.GetByIdWithProducts((int)id);

            if (category == null)
            {
                return(NotFound());
            }

            var categoryModel = _categoryModelFactory.PrepareCategoryModel(category);

            return(View(categoryModel));
        }