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))); }
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)); }
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)); }
public IActionResult News(int id) { if (id == 0) { return(View()); } var item = newsManager.GetById(id); return(View(item)); }