public void CreateDiscussion(CreateDiscussionViewModel model)
        {
            var discussion = Mapper.Map <Discussion>(model);

            Db.Discussions.Add(discussion);
            Db.SaveChanges();
        }
        public int AddCommentToArticle(FirstAppUser user, string commentText, int articleId)
        {
            var comment = new Comment();

            comment.FirstAppUser = user;
            comment.Content      = commentText;
            comment.ArticleId    = articleId;
            var article = ArticleService.GiveArticleById(articleId);

            Db.Comments.Add(comment);
            article.Comments.Add(comment);

            Db.SaveChanges();
            return(articleId);
        }
Beispiel #3
0
 public void Save()
 {
     _context.SaveChanges();
 }