Esempio n. 1
0
        public ActionResult ViewNewsById(int    id)
        {
            NewsService service = new NewsService();

            News item = service.GetById(id);
            List<News> relatedNews = service.GetRelatedNews(item.NewsID);
            ContentViewNewsModel model = new ContentViewNewsModel()
            {
                Category = item.Category,
                NewsItem = item,
                SubCategories = item.Category.Categories1.ToList(),
                RelatedNews = relatedNews

            };
            return View(model);
        }
Esempio n. 2
0
        //[AllowAccess]
        public ActionResult ViewNews(string news)
        {
            NewsService service = new NewsService();

            News item = service.GetNewsByKey(news);
            if (item.ViewCount.HasValue)
            {
                item.ViewCount = item.ViewCount++;
            }
            else
            {
                item.ViewCount = 1;
            }

            List<News> relatedNews = service.GetRelatedNews(item.NewsID);
            ContentViewNewsModel model = new ContentViewNewsModel()
            {
                Category = item.Category,
                NewsItem = item,
                SubCategories = item.Category.Categories1.ToList(),
                RelatedNews = relatedNews

            };
            return View(model);
        }