示例#1
0
 public ActionResult UpdateArticle(ArticleViewModel model)
 {
     model.DatePublication = DateTime.Now;
     TagHelper.DeleteTagArticle(model.Id);
     TagHelper.CreateArticle(model.Tags, model.Id);
     articleService.UpdateArticle(model.ToBllArticle());
     return(RedirectToAction("ViewArticle", "Article", new { articleId = model.Id }));
 }
示例#2
0
        public ActionResult CreateArticle(ArticleViewModel model)
        {
            model.DatePublication = DateTime.Now;
            model.CountShows      = 0;
            model.CountLikes      = 0;
            if (model.SectionId == 0)
            {
                model.SectionId = 1;
            }
            model.BloggerId = Convert.ToInt32(HttpContext.Profile.GetPropertyValue("Id"));
            articleService.CreateArticle(model.ToBllArticle());
            var article = articleService.GetAllArticleEntities().Where(a => a.Title == model.Title && a.DatePublication == model.DatePublication).FirstOrDefault();

            TagHelper.CreateArticle(model.Tags, article.Id);

            return(RedirectToAction("ViewArticle", "Article", new { articleId = article.Id }));
        }