public static MvcHtmlString PVServiceIcons(this HtmlHelper htmlHelper, PVServices services) { var sb = new StringBuilder(); if (services.HasFlag(PVServices.NicoNicoDouga)) { sb.Append(Image(htmlHelper, VideoServiceLinkUrl(htmlHelper, PVService.NicoNicoDouga), "NicoNicoDouga")); } if (services.HasFlag(PVServices.Youtube)) { sb.Append(Image(htmlHelper, VideoServiceLinkUrl(htmlHelper, PVService.Youtube), "Youtube")); } return(new MvcHtmlString(sb.ToString())); }
/// <summary> /// Returns a PV player with song rating by song Id. Primary PV will be chosen. /// </summary> public ActionResult PVPlayer(int id = invalidId, bool enableScriptAccess = false, string elementId = null, PVServices? pvServices = null) { if (id == invalidId) return NoId(); var pv = queries.PrimaryPVForSong(id, pvServices); if (pv == null) return new EmptyResult(); var embedParams = new PVEmbedParams { PV = pv, EnableScriptAccess = enableScriptAccess, ElementId = elementId }; var view = RenderPartialViewToString("PVs/_PVEmbedDynamicCustom", embedParams); return LowercaseJson(new SongWithPVPlayerAndVoteContract { PlayerHtml = view, PVId = pv.PVId, PVService = pv.Service }); }
public static IEnumerable <PVService> ToIndividualSelections(this PVServices selections) { return(EnumVal <PVServices> .GetIndividualValues(selections) .Select(s => (PVService)s)); }
public void Value(int expected, PVServices actual) { ((int)actual).Should().Be(expected); }
public PVServiceIconsViewModel(PVServices services) { Services = services; }
protected string GetPvUrl(Song song, PVType?type, PVServices services) { var pv = song.PVs.FirstOrDefault(p => (type == null || p.PVType == type) && services.HasFlag((PVServices)p.Service)); return(pv != null ? pv.Url : string.Empty); }