public ReleaseEventForApiContract(ReleaseEvent rel, ReleaseEventOptionalFields fields) { Date = rel.Date; Id = rel.Id; Name = rel.Name; SeriesNumber = rel.SeriesNumber; SeriesSuffix = rel.SeriesSuffix; UrlSlug = rel.UrlSlug; if (rel.Series != null) { SeriesId = rel.Series.Id; } if (fields.HasFlag(ReleaseEventOptionalFields.Description)) { Description = rel.Description; } if (fields.HasFlag(ReleaseEventOptionalFields.Series) && rel.Series != null) { Series = new ReleaseEventSeriesContract(rel.Series); } if (fields.HasFlag(ReleaseEventOptionalFields.SongList) && rel.SongList != null) { SongList = new SongListBaseContract(rel.SongList); } if (fields.HasFlag(ReleaseEventOptionalFields.WebLinks)) { WebLinks = rel.WebLinks.Select(w => new WebLinkForApiContract(w)).ToArray(); } }
public ReleaseEventForApiContract(ReleaseEvent rel, ContentLanguagePreference languagePreference, ReleaseEventOptionalFields fields, IEntryThumbPersister thumbPersister) { Category = rel.Category; Date = rel.Date; EndDate = rel.EndDate; Id = rel.Id; Name = rel.TranslatedName[languagePreference]; SeriesNumber = rel.SeriesNumber; SeriesSuffix = rel.SeriesSuffix; Status = rel.Status; UrlSlug = rel.UrlSlug; VenueName = rel.VenueName; Version = rel.Version; if (rel.HasSeries) { SeriesId = rel.Series.Id; } if (fields.HasFlag(ReleaseEventOptionalFields.AdditionalNames)) { AdditionalNames = rel.Names.GetAdditionalNamesStringForLanguage(languagePreference); } if (fields.HasFlag(ReleaseEventOptionalFields.Artists)) { Artists = rel.Artists.Select(a => new ArtistForEventContract(a, languagePreference)).ToArray(); } if (fields.HasFlag(ReleaseEventOptionalFields.Description)) { Description = rel.Description; } if (thumbPersister != null && fields.HasFlag(ReleaseEventOptionalFields.MainPicture)) { MainPicture = EntryThumbForApiContract.Create(EntryThumb.Create(rel) ?? EntryThumb.Create(rel.Series), thumbPersister); } if (fields.HasFlag(ReleaseEventOptionalFields.Names)) { Names = rel.Names.Select(n => new LocalizedStringContract(n)).ToArray(); } if (fields.HasFlag(ReleaseEventOptionalFields.Series) && rel.HasSeries) { Series = new ReleaseEventSeriesContract(rel.Series, languagePreference); } if (fields.HasFlag(ReleaseEventOptionalFields.SongList) && rel.SongList != null) { SongList = new SongListBaseContract(rel.SongList); } if (fields.HasFlag(ReleaseEventOptionalFields.WebLinks)) { WebLinks = rel.WebLinks.Select(w => new WebLinkForApiContract(w)).ToArray(); } }
public ReleaseEventForApiContract(ReleaseEvent rel, ReleaseEventOptionalFields fields) { Date = rel.Date; Id = rel.Id; Name = rel.Name; SeriesNumber = rel.SeriesNumber; SeriesSuffix = rel.SeriesSuffix; if (rel.Series != null) { SeriesId = rel.Series.Id; } if (fields.HasFlag(ReleaseEventOptionalFields.Description)) { Description = rel.Description; } if (fields.HasFlag(ReleaseEventOptionalFields.Series) && rel.Series != null) { Series = new ReleaseEventSeriesContract(rel.Series); } }
public ReleaseEventForApiContract(ReleaseEvent rel, ReleaseEventOptionalFields fields) { Date = rel.Date; Id = rel.Id; Name = rel.Name; SeriesNumber = rel.SeriesNumber; SeriesSuffix = rel.SeriesSuffix; if (rel.Series != null) { SeriesId = rel.Series.Id; } if (fields.HasFlag(ReleaseEventOptionalFields.Description)) { Description = rel.Description; } if (fields.HasFlag(ReleaseEventOptionalFields.Series) && rel.Series != null) { Series = new ReleaseEventSeriesContract(rel.Series); } }