예제 #1
0
        public ArtistDetailsContract GetArtistDetails(string term)
        {
            var artists = artistService.FindArtists(new ArtistQueryParams(ArtistSearchTextQuery.Create(term), new ArtistType[] {}, 0, 10,
                                                                          false, ArtistSortRule.Name, true));

            if (!artists.Items.Any())
            {
                return(null);
            }

            return(artistQueries.GetDetails(artists.Items[0].Id));
        }
예제 #2
0
        //
        // GET: /Artist/Details/5

        public ActionResult Details(int id = invalidId)
        {
            if (id == invalidId)
            {
                return(HttpNotFound());
            }

            WebHelper.VerifyUserAgent(Request);

            var model = queries.GetDetails(id, GetHostnameForValidHit());

            var hasDescription = !model.Description.IsEmpty;
            var prop           = PageProperties;

            prop.GlobalSearchType          = EntryType.Artist;
            prop.Title                     = model.Name;
            prop.Subtitle                  = string.Format("({0})", Translate.ArtistTypeName(model.ArtistType));
            prop.Description               = new ArtistDescriptionGenerator().GenerateDescription(model, markdownParser.GetPlainText(model.Description.EnglishOrOriginal), Translate.ArtistTypeNames);
            prop.CanonicalUrl              = UrlMapper.FullAbsolute(Url.Action("Details", new { id }));
            prop.OpenGraph.Image           = Url.ImageThumb(model, Model.Domain.Images.ImageSize.Original, fullUrl: true);
            prop.OpenGraph.Title           = hasDescription ? string.Format("{0} ({1})", model.Name, Translate.ArtistTypeName(model.ArtistType)) : model.Name;
            prop.OpenGraph.ShowTwitterCard = true;

            return(View(model));
        }
예제 #3
0
        public ArtistDetailsContract GetArtistDetails(string term)
        {
            var matchMode = NameMatchMode.Auto;

            term = FindHelpers.GetMatchModeAndQueryForSearch(term, ref matchMode);

            var artists = Services.Artists.FindArtists(new ArtistQueryParams(term, new ArtistType[] {}, 0, 10,
                                                                             false, false, matchMode, ArtistSortRule.Name, true));

            if (!artists.Items.Any())
            {
                return(null);
            }

            return(artistQueries.GetDetails(artists.Items[0].Id));
        }
예제 #4
0
        public void GetDetails()
        {
            var result = _queries.GetDetails(_artist.Id, "39.39.39.39");

            result.Name.Should().Be("Tripshots", "Name");

            var hit = _repository.List <ArtistHit>().FirstOrDefault(a => a.Entry.Equals(_artist));

            hit.Should().NotBeNull("Hit was created");
            hit.Agent.Should().Be(_user.Id, "Hit creator");
        }
예제 #5
0
        public void GetDetails()
        {
            var result = queries.GetDetails(artist.Id, "39.39.39.39");

            Assert.AreEqual("Tripshots", result.Name, "Name");

            var hit = repository.List <ArtistHit>().FirstOrDefault(a => a.Entry.Equals(artist));

            Assert.IsNotNull(hit, "Hit was created");
            Assert.AreEqual(user.Id, hit.Agent, "Hit creator");
        }
예제 #6
0
        //
        // GET: /Artist/Details/5

        public ActionResult Details(int id = invalidId)
        {
            if (id == invalidId)
            {
                return(HttpNotFound());
            }

            WebHelper.VerifyUserAgent(Request);
            var model = queries.GetDetails(id);

            PageProperties.Description = model.Description;
            return(View(model));
        }