//
        // GET: /Post/Create?TopicId=1234..7890
        // GET: /Post/Create?TopicId=1234..7890&ParentId=4312..0987

        public ViewResult Create(Guid topicId, Guid? parentId)
        {
            var topic = _topicRepository.FindBy(topicId);

            var post = new Post {Topic = topic};

            if (parentId.HasValue)
            {
                post.Parent = _postRepository.FindBy(parentId.Value);
            }

            var input = new PostToInputMapper().Map(post);

            return View(input);
        }
        private void PostIs_(string action)
        {
            switch (action)
            {
                case Loaded:
                    _post = Session.Load<Post>(_postId);
                    break;

                case Saved:
                    Session.SaveOrUpdate(_post);
                    Assert.That(Session.IsDirty());
                    Session.Flush();
                    _postId = _post.Id;
                    break;

                case Modified:
                    _post.Body = string.Format("{0} {1}", _post.Body, Modified);
                    _post.Flagged = !_post.Flagged;
                    break;

                case Deleted:
                    Session.Delete(_post);
                    Assert.That(Session.IsDirty());
                    Session.Flush();
                    break;
            }
        }
 private void PostWith_ChildrenAnd_Attachments(int childCount, int attachmentCount)
 {
     _post = PostFixtures.RootPostWithNoChildren(1);
     if (childCount > 0)
     {
         _ChildrenAddedToPost(childCount);
     }
     if (attachmentCount > 0)
     {
         _AttachmentsAddedToPost(attachmentCount);
     }
 }
Beispiel #4
0
 public virtual bool Equals(Post other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return base.Equals(other) && other.Flagged.Equals(Flagged);
 }
Beispiel #5
0
 public virtual void Remove(Post child)
 {
     child.Parent = null;
     child.Topic = null;
     _children.Remove(child);
 }
Beispiel #6
0
 public virtual void Add(Post child)
 {
     child.Parent = this;
     child.Topic = Topic;
     _children.Add(child);
 }
Beispiel #7
0
 public virtual void Remove(Post post)
 {
     post.Topic = null;
     _posts.Remove(post);
 }
Beispiel #8
0
 public virtual void Add(Post post)
 {
     post.Topic = this;
     post.Parent = null;
     _posts.Add(post);
 }