public virtual IActionResult Create() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCategories)) { return(AccessDeniedView()); } //prepare model var model = _categoryModelFactory.PrepareCategoryModel(new CategoryModel(), null); return(View(model)); }
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)); }
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)); }