Пример #1
0
        // GET: Health/News/5
        public ActionResult News(string id)
        {
            string category = "Health";

            ViewBag.Category = category;

            ViewBag.HasMedia                = AppFunctions.ArticleHasMediaFile(AppFunctions.GetArticleIdFromIdentifier(id));
            ViewBag.ArticleMediaFileName    = AppFunctions.GetArticleMediaData(AppFunctions.GetArticleIdFromIdentifier(id), "FileName");
            ViewBag.ArticleMediaFileCaption = AppFunctions.GetArticleMediaData(AppFunctions.GetArticleIdFromIdentifier(id), "FileCaption");

            ViewBag.ArticleMediaFileType = AppFunctions.GetArticleMediaData(AppFunctions.GetArticleIdFromIdentifier(id), "FileType");
            string text_id = id;

            if (String.IsNullOrEmpty(text_id))
            {
                return(PartialView("~/Views/Home/_404.cshtml"));
            }
            int article_id = AppFunctions.GetNewsArticleIDFromTextID(text_id);
            NewsArticlesModel newsArticlesModel = db.NewsArticles.Find(article_id);

            if (newsArticlesModel == null)
            {
                return(PartialView("~/Views/Home/_404.cshtml"));
            }

            //Count page visit
            AppFunctions.AddArticlePageVisit(article_id);

            return(View(newsArticlesModel));
        }