public virtual void DeleteCategory(Category category) { if (category == null) throw new ArgumentNullException("category"); category.Deleted = true; UpdateCategory(category); }
public virtual void UpdateCategory(Category category) { if (category == null) throw new ArgumentNullException("category"); //validate category hierarchy var parentCategory = GetCategoryById(category.ParentCategoryId); while (parentCategory != null) { if (category.Id == parentCategory.Id) { category.ParentCategoryId = 0; break; } parentCategory = GetCategoryById(parentCategory.ParentCategoryId); } _categoryRepository.Update(category); //cache _cacheManager.RemoveByPattern(CATEGORIES_PATTERN_KEY); }
public virtual void InsertCategory(Category category) { if (category == null) throw new ArgumentNullException("category"); _categoryRepository.Insert(category); //cache _cacheManager.RemoveByPattern(CATEGORIES_PATTERN_KEY); }