public ActionResult CategoryCategoryInsert(GridCommand command, Nop.Plugin.Misc.MultipleParents.Models.CategoryModel.CategoryCategoryModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog)) return AccessDeniedView(); int parentCategoryId = 0; if (!String.IsNullOrEmpty(model.Category) && Int32.TryParse(model.Category, out parentCategoryId)) { var categoryCategory = new CategoryCategory() { ChildCategoryId = model.ChildCategoryId, DisplayOrder = model.DisplayOrder1 }; //use Category property (not CategoryId) because appropriate property is stored in it categoryCategory.ParentCategoryId = parentCategoryId; if (categoryCategory.ParentCategoryId == 0) categoryCategory.ParentCategoryId = null; _categoryService.InsertCategoryCategory(categoryCategory); } return CategoryCategoryList(command, model.ChildCategoryId); }
/// <summary> /// Updates the category category mapping /// </summary> /// <param name="categoryCategory">>Category category mapping</param> public virtual void UpdateCategoryCategory(CategoryCategory categoryCategory) { if (categoryCategory == null) throw new ArgumentNullException("categoryCategory"); _categoryCategoryRepository.Update(categoryCategory); //cache _cacheManager.RemoveByPattern(CATEGORIES_PATTERN_KEY); _cacheManager.RemoveByPattern(CATEGORYCATEGORIES_PATTERN_KEY); _cacheManager.RemoveByPattern(CATEGORY_ALLPARENTCHILDCATEGORIES_KEY); //event notification _eventPublisher.EntityUpdated(categoryCategory); }