public void DeleteComment(Comment comment)
 {
     using (ISession session = OpenSession())
     {
         session.Delete(comment);
         session.Flush();
     }
 }
        public void AddComment(Comment comment)
        {
            using (ISession session = OpenSession())
            {
                using (ITransaction transaction = session.BeginTransaction())
                {
                    session.SaveOrUpdate(comment);

                    transaction.Commit();
                }
            }
        }
Esempio n. 3
0
 public void DeleteComment(Comment comment)
 {
     writeBlogRepository.DeleteComment(comment);
 }
Esempio n. 4
0
 public void AddComment(Comment comment)
 {
     writeBlogRepository.AddComment(comment);
 }
Esempio n. 5
0
 public void DeleteComment(Comment comment)
 {
     throw new NotImplementedException();
 }
Esempio n. 6
0
 private static void OnAction(DeleteCommentRequest request)
 {
     var comment = new Comment { Id = request.CommentId };
     repository.DeleteComment(comment);
     Console.WriteLine("Удалён коментарий: '{0}'", comment.Id);
 }
Esempio n. 7
0
 private static void OnAction(AddCommentRequest request)
 {
     var comment = new Comment { CreateDate = DateTime.Now, Post = new BlogPost { Id = request.PostId }, Text = request.Text };
     repository.AddComment(comment);
     Console.WriteLine("Добавлен коментарий: '{0}' от {1}", comment.Text, comment.CreateDate.ToString());
 }