Example #1
0
        public ActionResult NewArticle(NewArticleModel newArticleModel)
        {
            if (newArticleModel.Tags.Length > 0)
            {
                ITagService   tagService = new TagService();
                List <string> tagList    = tagService.ParseTags(newArticleModel.Tags);

                List <tblTags> dbLinkedTags = tagService.FindOrAddTags(tagList);

                tblArticles article = new tblArticles()
                {
                    Content = newArticleModel.Content,
                    Header  = newArticleModel.Header,
                    Date    = DateTime.Now,
                    UserID  = 1
                };
                this._articleManager.AddNewArticle(article);
                tagService.AttachTagToArticle(dbLinkedTags, article);
            }
            return(Redirect(Url.Content("~/")));
        }