public SongListForApiContract(SongList list, ContentLanguagePreference languagePreference, IUserIconFactory userIconFactory, IAggregatedEntryImageUrlFactory imagePersister, SongListOptionalFields fields) : base(list) { ParamIs.NotNull(() => list); Author = new UserForApiContract(list.Author, userIconFactory, UserOptionalFields.None); Deleted = list.Deleted; EventDate = list.EventDate; Status = list.Status; if (fields.HasFlag(SongListOptionalFields.Description)) { Description = list.Description; } if (fields.HasFlag(SongListOptionalFields.Events)) { Events = list.Events.Select(e => new ReleaseEventForApiContract(e, languagePreference, ReleaseEventOptionalFields.Venue, imagePersister)).OrderBy(e => e.Date).ThenBy(e => e.Name).ToArray(); } if (fields.HasFlag(SongListOptionalFields.MainPicture)) { MainPicture = list.Thumb != null ? new EntryThumbForApiContract(list.Thumb, imagePersister) : null; } if (fields.HasFlag(SongListOptionalFields.Tags)) { Tags = list.Tags.ActiveUsages.Select(u => new TagUsageForApiContract(u, languagePreference)).OrderByDescending(u => u.Count).ToArray(); } }
public SongListForApiContract(SongList list, IUserIconFactory userIconFactory, IEntryImagePersister imagePersister, bool ssl, SongListOptionalFields fields) : base(list) { ParamIs.NotNull(() => list); Author = new UserForApiContract(list.Author, userIconFactory, UserOptionalFields.None); EventDate = list.EventDate; if (fields.HasFlag(SongListOptionalFields.MainPicture)) { MainPicture = (list.Thumb != null ? new EntryThumbForApiContract(list.Thumb, imagePersister, ssl) : null); } }
public PartialFindResult <SongListForApiContract> GetFeaturedLists( string query = "", [FromUri] int[] tagId = null, bool childTags = false, NameMatchMode nameMatchMode = NameMatchMode.Auto, SongListFeaturedCategory?featuredCategory = null, int start = 0, int maxResults = defaultMax, bool getTotalCount = false, SongListSortRule sort = SongListSortRule.Name, SongListOptionalFields fields = SongListOptionalFields.None, ContentLanguagePreference lang = ContentLanguagePreference.Default) { var textQuery = SearchTextQuery.Create(query, nameMatchMode); var queryParams = new SongListQueryParams { TextQuery = textQuery, FeaturedCategory = featuredCategory, Paging = new PagingProperties(start, maxResults, getTotalCount), SortRule = sort, TagIds = tagId, ChildTags = childTags }; return(queries.Find(s => new SongListForApiContract(s, lang, userIconFactory, entryImagePersister, fields), queryParams)); }