コード例 #1
0
        public async Task <ActionResult> EntryToolTip(string url, string callback)
        {
            if (string.IsNullOrWhiteSpace(url))
            {
                return(HttpStatusCodeResult(HttpStatusCode.BadRequest, "URL must be specified"));
            }

            var entryId = _entryUrlParser.Parse(url, allowRelative: true);

            if (entryId.IsEmpty)
            {
                return(HttpStatusCodeResult(HttpStatusCode.BadRequest, "Invalid URL"));
            }

            var data = string.Empty;
            var id   = entryId.Id;

            switch (entryId.EntryType)
            {
            case EntryType.Album:
                data = await RenderPartialViewToStringAsync("AlbumWithCoverPopupContent", _albumService.GetAlbum(id));

                break;

            case EntryType.Artist:
                data = await RenderPartialViewToStringAsync("ArtistPopupContent", _artistService.GetArtist(id));

                break;

            case EntryType.ReleaseEvent:
                data = await RenderPartialViewToStringAsync("_EventPopupContent", _eventQueries.GetOne(id, ContentLanguagePreference.Default, ReleaseEventOptionalFields.AdditionalNames | ReleaseEventOptionalFields.MainPicture | ReleaseEventOptionalFields.Series));

                break;

            case EntryType.Song:
                data = await RenderPartialViewToStringAsync("SongPopupContent", _songService.GetSong(id));

                break;

            case EntryType.Tag:
                data = await RenderPartialViewToStringAsync("_TagPopupContent", _tagQueries.LoadTag(id, t =>
                                                                                                    new TagForApiContract(t, _entryThumbPersister, ContentLanguagePreference.Default, TagOptionalFields.AdditionalNames | TagOptionalFields.MainPicture)));

                break;
            }

            return(Json(data, callback));
        }
コード例 #2
0
 public ReleaseEventForApiContract GetOne(int id,
                                          ReleaseEventOptionalFields fields = ReleaseEventOptionalFields.None,
                                          ContentLanguagePreference lang    = ContentLanguagePreference.Default) => queries.GetOne(id, lang, fields);
コード例 #3
0
 public ReleaseEventForApiContract GetOne(int id,
                                          ReleaseEventOptionalFields fields = ReleaseEventOptionalFields.None,
                                          ContentLanguagePreference lang    = ContentLanguagePreference.Default)
 {
     return(queries.GetOne(id, lang, fields, WebHelper.IsSSL(Request)));
 }