예제 #1
0
        public async Task <Post> Post(Guid id, NewPost newPost)
        {
            FilterDefinition <User> filter = Builders <User> .Filter.Eq("_id", id);

            User user = await _collection.Find(filter).FirstAsync();

            Post post = new Post();

            post.postString = newPost.postString;
            post.date       = DateTime.Now;
            post.postid     = Guid.NewGuid();
            user.Posts.Add(post);
            user.Activity = user.Activity + 5;
            await _collection.ReplaceOneAsync(filter, user);

            return(post);
        }
예제 #2
0
 public Task <Post> Post(Guid id, NewPost newPost)
 {
     return(_repository.Post(id, newPost));
 }
예제 #3
0
 public Task <Post> Post(Guid id, NewPost newPost)
 {
     return(_processor.Post(id, newPost));
 }