public static Category Load(Int32 categoryId, bool useCache) { if (categoryId == 0) { return(null); } Category category = null; string key = "Category_" + categoryId.ToString(); if (useCache) { category = ContextCache.GetObject(key) as Category; if (category != null) { return(category); } } category = new Category(); if (category.Load(categoryId)) { if (useCache) { ContextCache.SetObject(key, category); } return(category); } return(null); }
public static bool Delete(Int32 categoryId) { Category category = new Category(); if (category.Load(categoryId)) { return(category.Delete()); } return(false); }