コード例 #1
0
        public ActionResult Show(string permalink)
        {
            var giftcards = new GiftCardsIndex();

            try
            {
                var giftcard = _giftCardService.FindByPermalink(permalink);
                if (giftcard == null || !giftcard.IsPublished)
                {
                    return(HttpNotFound());
                }

                var giftCardShow = Mapper.Map <GiftCardShow>(giftcard);

                giftCardShow.Color = TempData["color"].ToString();

                SEOTool SEOTool = new SEOTool();

                if (giftcard.SEOTools != null && giftcard.SEOTools.Count > 0)
                {
                    SEOTool = giftcard.SEOTools.First();
                }


                ViewBag.FocusKeyword    = SEOTool.FocusKeyword;
                ViewBag.MetaDescription = SEOTool.MetaDescription;
                ViewBag.Title           = SEOTool.SEOTitle;

                return(View("show", giftCardShow));
            }
            catch (Exception e)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(e);
                return(HttpNotFound());
            }
        }