Пример #1
0
        public ActionResult Index(string id)
        {
            Guid tmp;

            if (!Guid.TryParse(id, out tmp) || newsManager.GetById(id) == null)
            {
                return(RedirectToRoute("Home"));
            }

            return(View(new NewsItemPageView(id)));
        }
Пример #2
0
 public NewsItemPageView(string id)
     : base()
 {
     newsManager = Resolver.GetInstance<INewsManager>();
     commentsManager = Resolver.GetInstance<ICommentsManager>();
     NewsItem = Mapper.Map<NewsItemViewModel, NewsItem>(newsManager.GetById(id));
     Comments = Mapper.Map<CommentViewModel, Comment>(commentsManager.GetList(NewsItem.Id));
 }
Пример #3
0
 public NewsItemPageView(string id)
     : base()
 {
     newsManager     = Resolver.GetInstance <INewsManager>();
     commentsManager = Resolver.GetInstance <ICommentsManager>();
     NewsItem        = Mapper.Map <NewsItemViewModel, NewsItem>(newsManager.GetById(id));
     Comments        = Mapper.Map <CommentViewModel, Comment>(commentsManager.GetList(NewsItem.Id));
 }
Пример #4
0
        public IActionResult News(int id)
        {
            if (id == 0)
            {
                return(View());
            }
            var item = newsManager.GetById(id);

            return(View(item));
        }