コード例 #1
0
        public ActionResult Details(int id = invalidId, string slug = null)
        {
            if (id == invalidId)
            {
                return(NoId());
            }

            slug = slug ?? string.Empty;

            var ev = queries.GetDetails(id);

            if (slug != ev.UrlSlug)
            {
                return(RedirectToActionPermanent("Details", new { id, slug = ev.UrlSlug }));
            }

            var    inheritedCategory = ev.InheritedCategory;
            string subtitle;

            if (inheritedCategory == EventCategory.Unspecified || inheritedCategory == EventCategory.Other)
            {
                subtitle = ViewRes.Event.DetailsStrings.Event;
            }
            else
            {
                subtitle = Translate.ReleaseEventCategoryNames[inheritedCategory];
            }

            var pictureData = !string.IsNullOrEmpty(ev.PictureMime) ? (IEntryImageInformation)ev : ev.Series;

            PageProperties.PageTitle       = string.Format("{0} ({1})", ev.Name, subtitle);
            PageProperties.Title           = ev.Name;
            PageProperties.Subtitle        = subtitle;
            PageProperties.CanonicalUrl    = entryLinkFactory.GetFullEntryUrl(EntryType.ReleaseEvent, ev.Id, ev.UrlSlug);
            PageProperties.OpenGraph.Image = Url.ImageThumb(pictureData, ImageSize.Original);
            // Note: description is set in view

            return(View(ev));
        }