Example #1
0
        public async Task <IHttpActionResult> AddComment(Guid id, [FromBody] string commentText)
        {
            var comment = new CatFactComment
            {
                Id        = Guid.NewGuid(),
                Timestamp = DateTime.UtcNow,
                Comment   = commentText
            };

            await _repository.AddComment(id, comment);

            return(Ok(comment));
        }
Example #2
0
 public Task AddComment(Guid id, CatFactComment comment)
 {
     return(Collection.UpdateOneAsync(x => x.Id == id, UpdateBuilder.Push(x => x.Comments, comment)));
 }