Ejemplo n.º 1
0
 public ICollection<MediaCategory> GetAllMediaCategoriesInHierarchy(MediaCategory mediaCategory)
 {
   ICollection<MediaCategory> result = new HashSet<MediaCategory> {mediaCategory};
   foreach (MediaCategory parentCategory in mediaCategory.ParentCategories)
     CollectionUtils.AddAll(result, GetAllMediaCategoriesInHierarchy(parentCategory));
   return result;
 }
Ejemplo n.º 2
0
    protected static XmlSerializer _xmlSerializer = null; // Lazy initialized

    #endregion

    public MediaCategory_DTO(MediaCategory mediaCategory)
    {
      _name = mediaCategory.CategoryName;
      _parentCategories = new HashSet<string>(mediaCategory.ParentCategories.Select(category => category.CategoryName));
    }
Ejemplo n.º 3
0
 public MediaCategory RegisterMediaCategory(string name, ICollection<MediaCategory> parentCategories)
 {
   MediaCategory result = new MediaCategory(name, parentCategories);
   _mediaCategories.Add(name, result);
   return result;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Returns all media category names of the given <paramref name="mediaCategory"/> and all its direct and indirect parent categories.
 /// </summary>
 /// <param name="mediaCategory">Media category to start building the hierarchy.</param>
 /// <returns>Collection of media category names.</returns>
 protected ICollection<string> GetMediaCategoryIncludingParents(MediaCategory mediaCategory)
 {
   ICollection<string> result = new List<string> { mediaCategory.CategoryName };
   foreach (MediaCategory parentCategory in mediaCategory.ParentCategories)
     CollectionUtils.AddAll(result, GetMediaCategoryIncludingParents(parentCategory));
   return result;
 }