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)); }
public Task AddComment(Guid id, CatFactComment comment) { return(Collection.UpdateOneAsync(x => x.Id == id, UpdateBuilder.Push(x => x.Comments, comment))); }