public void TestPutComment() { var localName = "test_multi_pages.docx"; var remoteName = "TestPutComment.docx"; var fullName = Path.Combine(this.dataFolder, remoteName); var nodeLink = new NodeLink { NodeId = "0.0.3" }; var documentPosition = new DocumentPosition { Node = nodeLink, Offset = 0 }; var body = new Comment { RangeStart = documentPosition, RangeEnd = documentPosition, Initial = "IA", Author = "Imran Anwar", Text = "A new Comment" }; this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir(BaseTestContext.CommonFolder) + localName)); var request = new PutCommentRequest(remoteName, body, this.dataFolder); var actual = this.WordsApi.PutComment(request); Assert.AreEqual(200, actual.Code); }
public async Task <IActionResult> PutComment([FromRoute] int id, [FromBody] PutCommentRequest request) { if (id != request.CommentId) // If the ID in the URL does not match the ID in the supplied request body, return a bad request { return(BadRequest(new StatusCodeProblemDetails(400) { Detail = "Id in URL and Comment don't match" })); } request.CurrentUserId = GetCurrentUserId(); var response = await _mediator.Send(request); if (response != null) { return(Ok()); } else { return(StatusCode(500)); } }