Ejemplo n.º 1
0
        public async Task <ActionResult> ArticleDetails(Guid?id)
        {
            var ArticleManage = new ArticleManage();

            if (id == null || !await new ArticleManage().ExistsArticle(id.Value))
            {
                return(RedirectToAction(nameof(ArticleList)));
            }
            ViewBag.Comments = await  new ArticleManage().GetCommentsByArticleId(id.Value);
            return(View(await ArticleManage.GetOneArticleById(id.Value)));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> EditArticle(Guid id)
        {
            var articleManage = new ArticleManage();
            var data          = await articleManage.GetOneArticleById(id);

            var userid = Guid.Parse(Session["userId"].ToString());

            ViewBag.CategoryIds = await new ArticleManage().GetAllCagetory(userid);
            return(View(new EditArticleViewModel()
            {
                Id = data.Id,
                Title = data.Title,
                Content = data.Content,
                CategoryIds = data.CategoryIds
            }));
        }