public ActionResult Single(int id)
        {
            ArticleSingleModel singleModel = new ArticleSingleModel();

            singleModel = articleService.GetById(id);
            singleModel = articleService.GetPreOrNextArticleId(id);
            return(View(singleModel));
        }
 public ArticleService()
 {
     articleRepository  = new ArticleRepository(Context);
     userRepository     = new UserRepository(Context);
     keywordRepository  = new KeywordRepository(Context);
     appraiseRepository = new AppraiseRepository(Context);
     commentRepository  = new CommentRepository(Context);
     singleModel        = new ArticleSingleModel();
 }
        public ArticleSingleModel GetById(int id)
        {
            Article article = articleRepository.GetRelevance(id).SingleOrDefault();

            singleModel = mapper.Map <ArticleSingleModel>(article);
            int commentAmount = commentRepository.GetByArticle(id).Count <Comment>();

            singleModel.CommentCount = commentAmount;
            return(singleModel);
        }
Example #4
0
        public IModel Read(Dictionary <string, object> r)
        {
            var          m    = new ArticleSingleModel();
            var          type = typeof(ArticleSingleModel);
            var          guid = new Guid(r["cID"].ToString());
            PropertyInfo pi   = type.BaseType.GetProperty("ID");

            pi.SetValue(m, guid);

            m.CatalogID = new Guid(r["cCatalogID"].ToString());
            m.No        = r["cNo"].ToString();
            m.Title     = r["cTitle"].ToString();
            return(m);
        }
        public ActionResult Single(int id)
        {
            ArticleSingleModel articleSingleModel = _articleService.GetArticleSingelModelById(id);

            return(View(articleSingleModel));
        }