Exemple #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);
        }
 public Task <Post> Post(Guid id, NewPost newPost)
 {
     return(_repository.Post(id, newPost));
 }
 public Task <Post> Post(Guid id, NewPost newPost)
 {
     return(_processor.Post(id, newPost));
 }