public TagMappingContract(TagMapping tagMapping, ContentLanguagePreference lang) { ParamIs.NotNull(() => tagMapping); SourceTag = tagMapping.SourceTag; Tag = new TagBaseContract(tagMapping.Tag, lang); }
public TagForApiContract(Tag tag, IEntryImagePersisterOld thumbPersister, ContentLanguagePreference languagePreference, TagOptionalFields optionalFields) { ParamIs.NotNull(() => tag); CategoryName = tag.CategoryName; CreateDate = tag.CreateDate; DefaultNameLanguage = tag.TranslatedName.DefaultLanguage; Id = tag.Id; Name = tag.TranslatedName[languagePreference]; Status = tag.Status; Targets = (int)tag.Targets; UrlSlug = tag.UrlSlug; UsageCount = tag.UsageCount; Version = tag.Version; var includeAdditionalNames = optionalFields.HasFlag(TagOptionalFields.AdditionalNames); if (includeAdditionalNames) { AdditionalNames = tag.Names.GetAdditionalNamesStringForLanguage(languagePreference); } if (optionalFields.HasFlag(TagOptionalFields.Description)) { Description = tag.Description[languagePreference]; } if (optionalFields.HasFlag(TagOptionalFields.MainPicture) && tag.Thumb != null && thumbPersister != null) { MainPicture = new EntryThumbForApiContract(tag.Thumb, thumbPersister); } if (optionalFields.HasFlag(TagOptionalFields.Names)) { Names = tag.Names.Select(n => new LocalizedStringWithIdContract(n)).ToArray(); } if (optionalFields.HasFlag(TagOptionalFields.Parent) && tag.Parent != null) { Parent = new TagBaseContract(tag.Parent, languagePreference, includeAdditionalNames); } if (optionalFields.HasFlag(TagOptionalFields.RelatedTags)) { RelatedTags = tag.RelatedTags.Select(t => new TagBaseContract(t.LinkedTag, languagePreference, includeAdditionalNames)).ToArray(); } if (optionalFields.HasFlag(TagOptionalFields.TranslatedDescription)) { TranslatedDescription = new EnglishTranslatedStringContract(tag.Description); } if (optionalFields.HasFlag(TagOptionalFields.WebLinks)) { WebLinks = tag.WebLinks.Links.Select(w => new WebLinkForApiContract(w)).ToArray(); } }
public TagUsageWithVotesContract(TagUsage usage, ContentLanguagePreference languagePreference) { Count = usage.Count; Date = usage.Date; Id = usage.Id; Tag = new TagBaseContract(usage.Tag, languagePreference); Votes = usage.VotesBase.Select(v => new UserContract(v.User)).ToArray(); }
public TagUsageWithVotesContract(TagUsage usage, ContentLanguagePreference languagePreference, IUserIconFactory userIconFactory) { Count = usage.Count; Date = usage.Date; Id = usage.Id; Tag = new TagBaseContract(usage.Tag, languagePreference); Votes = usage.VotesBase.Select(v => new UserForApiContract(v.User, userIconFactory, UserOptionalFields.MainPicture)).ToArray(); }
public TagUsageForApiContract(Tag tag, int count, ContentLanguagePreference languagePreference) { Count = count; Tag = new TagBaseContract(tag, languagePreference, includeAdditionalNames: true, includeCategory: true); }
public TagUsageForApiContract(Tag tag, int count, ContentLanguagePreference languagePreference) { Count = count; Tag = new TagBaseContract(tag, languagePreference, true); }
public TagUsageForApiContract(TagUsage tagUsage, ContentLanguagePreference languagePreference) { Count = tagUsage.Count; Tag = new TagBaseContract(tagUsage.Tag, languagePreference, true); }
public TagEntryMappingContract(EntryTypeToTagMapping mapping, ContentLanguagePreference languagePreference) { EntryType = mapping.EntryTypeAndSubType; Tag = new TagBaseContract(mapping.Tag, languagePreference); }
public TagSelectionContract(Tag tag, ContentLanguagePreference languagePreference, bool selected) { Tag = new TagBaseContract(tag, languagePreference, true); Selected = selected; }