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(); } } }
public void DeleteComment(Comment comment) { writeBlogRepository.DeleteComment(comment); }
public void AddComment(Comment comment) { writeBlogRepository.AddComment(comment); }
public void DeleteComment(Comment comment) { throw new NotImplementedException(); }
private static void OnAction(DeleteCommentRequest request) { var comment = new Comment { Id = request.CommentId }; repository.DeleteComment(comment); Console.WriteLine("Удалён коментарий: '{0}'", comment.Id); }
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()); }