Exemplo n.º 1
0
 private void FillViewNewsModel(ViewNewsModel model, NewsData data)
 {
     model.PreviousNews = Execute(() => _newsService.GetPreviousNews(model.Id.GetValueOrDefault(), Constants.PreviousNewsCount)) ?? new List<NewsData>();
     model.CopyFrom(data);
 }
Exemplo n.º 2
0
        public ActionResult ViewNews(int? id)
        {
            if (id.HasValue)
            {
                var model = new ViewNewsModel { Id = id.GetValueOrDefault() };

                var news = Execute(() => _newsService.GetNews(model.Id.GetValueOrDefault()));
                if (news == null)
                    return RedirectToAction<NewsController>(o => o.News());

                //Execute(() => _newsService.ChangeCountViews(news.Id));
                FillViewNewsModel(model, news);

                return View(model);
            }

            return RedirectToAction<NewsController>(o => o.News());
        }