public ValidationStateDictionary AddPost(Post post)
        {
            post.ID = Guid.NewGuid();

            AddedPosts.Add(post);

            return(new ValidationStateDictionary(typeof(Post), new ValidationState()));
        }
        public ModelResult <Post> AddPost(PostInput postInput, EntityState state, User creator)
        {
            ValidationStateDictionary validationState = new ValidationStateDictionary(typeof(Post), new ValidationState());

            Post post = new Post(null, null, null, false, DateTime.MinValue, creator, Guid.NewGuid(), null, DateTime.MinValue, null, null, state, null, null, null);

            AddedPosts.Add(post);

            return(new ModelResult <Post>(post, validationState));
        }
        public void AddPost(Post post, User currentUser, bool fireEvents, out ValidationStateDictionary validationState, out Post newPost)
        {
            validationState = new ValidationStateDictionary(typeof(Post), new ValidationState());

            post.Creator = currentUser;
            post.ID      = Guid.NewGuid();

            AddedPosts.Add(post);

            newPost = post;
        }
 public Post GetPost(Guid id)
 {
     return(AddedPosts.Where(p => p.ID == id).FirstOrDefault());
 }
 public Post GetPost(PostAddress postAddress)
 {
     return(AddedPosts.Where(p => p.Slug == postAddress.Slug).FirstOrDefault());
 }
 public IPageOfList <Post> GetPosts(int pageIndex, int pageSize, Area area, DateTime?sinceDate)
 {
     return(new PageOfList <Post>(AddedPosts.Where(p => p.Area.ID == area.ID), pageIndex, pageSize, AddedPosts.Count));
 }
Beispiel #7
0
 public Post GetPost(Area area, string slug)
 {
     return(AddedPosts.Where(p => p.Slug == slug).FirstOrDefault());
 }
 public IPageOfItems <Post> GetPosts(int pageIndex, int pageSize, AreaAddress areaAddress, DateTime?sinceDate)
 {
     return(new PageOfItems <Post>(AddedPosts.Where(p => p.Area.Name == areaAddress.AreaName), pageIndex, pageSize, AddedPosts.Count));
 }