public void DeletePost(BlogPost post) { using (ISession session = OpenSession()) { session.Delete(post); session.Flush(); } }
/// <summary> /// Добавить новую статью /// </summary> /// <param name="post">Статья для добавления</param> public void AddPost(BlogPost post) { using (ISession session = OpenSession()) { using (ITransaction transaction = session.BeginTransaction()) { session.SaveOrUpdate(post); transaction.Commit(); } } }
public void DeletePost(BlogPost post) { writeBlogRepository.DeletePost(post); }
public void AddPost(BlogPost post) { writeBlogRepository.AddPost(post); }
public void DeletePost(BlogPost post) { throw new NotImplementedException(); }
private static void OnAction(DeletePostRequest request) { var post = new BlogPost { Id = request.PostId }; repository.DeletePost(post); Console.WriteLine("Удалёна статья: '{0}'", post.Id); }
private static void OnAction(AddPostRequest request) { var post = new BlogPost { Text = request.Text, Title = request.Title, CreateDate = DateTime.Now }; repository.AddPost(post); Console.WriteLine("Добавлена статья: '{0}' от {1}", post.Title, post.CreateDate); }