public void LoadSearchCategories() { // Get all categories from database LoadCategories(); if (Categories.Count > 0) { // Load search categories SearchCategories.AddRange(Categories); // Add category for 'Search All' Category entity = new Category(); entity.CategoryId = 0; entity.CategoryName = "-- Search All Categories --"; // Insert "Search" at the top SearchCategories.Insert(0, entity); } }
public void LoadSearchCategories() { PTCEntities db = new PTCEntities(); if (Categories.Count == 0) { SearchCategories.AddRange(db.Categories); } else { SearchCategories.AddRange(Categories); } Category entity = new Category(); entity.CategoryId = 0; entity.CategoryName = "--- Search All Categories ---"; SearchCategories.AddRange(Categories); SearchCategories.Insert(0, entity); }
public void LoadSearchCategories() { PTCEntities db = new PTCEntities(); if (Categories.Count == 0) { // Load categories SearchCategories.AddRange(db.Categories); } else { SearchCategories.AddRange(Categories); } // Add category for 'Search All' Category entity = new Category(); entity.CategoryId = 0; entity.CategoryName = "-- Search All Categories --"; SearchCategories.AddRange(Categories); // Insert "Search" at the top SearchCategories.Insert(0, entity); }