Ejemplo n.º 1
0
        public ActionResult Details(string url)
        {
            var modelDb = _context.GetArticle(url);

            if (modelDb == null)
            {
                return(RedirectToAction("Index"));
            }
            var model = Mapper.Map <NewsDetailsVm>(modelDb);

            model.SimilarNews = Mapper.Map <List <ArticleBaseVm> >(_context.GetSimilarNews(model.ArticleId));
            ViewBag.Keywords  = model.Tags;
            if (Request.Url != null)
            {
                ViewBag.OgImage = string.Format("{0}{1}",
                                                Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, string.Empty), model.PictureUrlSmall);
            }
            ViewBag.Description = model.ShortInfoCutted(150);
            return(View(model));
        }