Beispiel #1
0
        public ActionResult Details(int id = invalidId)
        {
            if (id == invalidId)
            {
                return(NoId());
            }

            var contract = queries.GetDetails(id);

            PageProperties.CanonicalUrl = VocaUriBuilder.CreateAbsolute(Url.Action("Details", new { id })).ToString();
            PageProperties.Description  = contract.Description;

            if (contract.FeaturedCategory == SongListFeaturedCategory.Nothing)
            {
                PageProperties.PageTitle = string.Format("{0} - {1}", ViewRes.SongList.DetailsStrings.SongList, contract.Name);
                PageProperties.Title     = contract.Name;
                PageProperties.Subtitle  = ViewRes.SongList.DetailsStrings.SongList;
            }
            else
            {
                var categoryName = Translate.SongListFeaturedCategoryNames[contract.FeaturedCategory];

                PageProperties.PageTitle = string.Format("{0} - {1}", categoryName, contract.Name);
                PageProperties.Title     = contract.Name;
                PageProperties.Subtitle  = categoryName;
            }

            var viewModel = new SongListDetailsViewModel(contract, PermissionContext);

            viewModel.SmallThumbUrl = Url.ImageThumb(contract.MainPicture, ImageSize.SmallThumb);
            var thumbUrl = viewModel.ThumbUrl = Url.ImageThumb(contract.MainPicture, ImageSize.Original) ?? Url.ImageThumb(contract.MainPicture, ImageSize.Thumb);

            if (!string.IsNullOrEmpty(thumbUrl))
            {
                PageProperties.OpenGraph.Image = thumbUrl;
            }

            PageProperties.OpenGraph.ShowTwitterCard = true;

            return(View(viewModel));
        }