Exemplo n.º 1
0
        public void RemovePost(MetaWeblogPostAddress postAddress)
        {
            if (postAddress == null)
            {
                throw new ArgumentNullException("postAddress");
            }
            if (postAddress.PostID == Guid.Empty)
            {
                throw new ArgumentException("PostID must be set");
            }

            using (TransactionScope transaction = new TransactionScope())
            {
                Post post = repository.GetPost(postAddress.PostID);

                if (post != null)
                {
                    if (repository.RemovePost(post))
                    {
                        invalidateCachedPostForRemove(post);

                        transaction.Complete();

                        pluginEngine.ExecuteAll("PostRemoved", new { context, post = new PostReadOnly(post, urlHelper.AbsolutePath(urlHelper.Post(post))) });

                        return;
                    }
                }
            }
        }
Exemplo n.º 2
0
 public Post GetPost(MetaWeblogPostAddress postAddress)
 {
     return(cache.GetItem <Post>(
                string.Format("GetPost-Post:{0:N}", postAddress.PostID),
                () => pluginEngine.ProcessDisplayOfPost(context, () => repository.GetPost(postAddress.PostID).FillTags(tagService)),
                p => p.GetDependencies()
                ));
 }