Exemplo n.º 1
0
 public void DeletePost(BlogPost post)
 {
     using (ISession session = OpenSession())
     {
         session.Delete(post);
         session.Flush();
     }
 }
Exemplo n.º 2
0
        /// <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();
                }
            }
        }
Exemplo n.º 3
0
 public void DeletePost(BlogPost post)
 {
     writeBlogRepository.DeletePost(post);
 }
Exemplo n.º 4
0
 public void AddPost(BlogPost post)
 {
     writeBlogRepository.AddPost(post);
 }
Exemplo n.º 5
0
 public void DeletePost(BlogPost post)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 6
0
 private static void OnAction(DeletePostRequest request)
 {
     var post = new BlogPost { Id = request.PostId };
     repository.DeletePost(post);
     Console.WriteLine("Удалёна статья: '{0}'", post.Id);
 }
Exemplo n.º 7
0
 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);
 }