public CategoryRepository Add(CategoryProperties category) { if (_categories.ContainsKey(category.Key)) { throw new DuplicateCategoryException(category.Key.ToString()); } _categories.Add(category.Key, category); return(this); }
public static CategoryProperties GetCategoryPropertiesFromCategory(Category searchedCategory) { CategoryProperties theCategoryProperties = null; for (int i = 0; i < categoriesProperties.Count; i++) { if (categoriesProperties[i].category == searchedCategory) { theCategoryProperties = categoriesProperties[i]; } } return(theCategoryProperties); }
/// <summary> /// Create a new CategoryProperties object. /// </summary> /// <param name="id">Initial value of Id.</param> /// <param name="isMainProperty">Initial value of IsMainProperty.</param> public static CategoryProperties CreateCategoryProperties(int id, bool isMainProperty) { CategoryProperties categoryProperties = new CategoryProperties(); categoryProperties.Id = id; categoryProperties.IsMainProperty = isMainProperty; return categoryProperties; }
/// <summary> /// There are no comments for CategoryProperties in the schema. /// </summary> public void AddToCategoryProperties(CategoryProperties categoryProperties) { base.AddObject("CategoryProperties", categoryProperties); }
private CategoryProperties GetCategoryProperties(PropertyModel property, ICollection<CategoryProperties> list) { // Setup initial conditions. var categoryName = GetCategory(property); if (categoryName == null) categoryName = LabelMiscellaneous; // Retrieve the category object if it exists, and if not found create it. var category = list.FirstOrDefault(item => item.CategoryName == categoryName); if (category == null) { category = new CategoryProperties {CategoryName = categoryName}; list.Add(category); } // Finish up. return category; }