diff --git a/GroupDocs.Annotation for .NET/Controllers/AddAnnotationController.cs b/GroupDocs.Annotation for .NET/Controllers/AddAnnotationController.cs index 50a3298..2c46d7d 100644 --- a/GroupDocs.Annotation for .NET/Controllers/AddAnnotationController.cs +++ b/GroupDocs.Annotation for .NET/Controllers/AddAnnotationController.cs @@ -8,6 +8,7 @@ using Newtonsoft.Json.Serialization; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Web; using System.Web.Mvc; @@ -29,10 +30,8 @@ public ActionResult Post(string file) Document doc = documentDataHandler.GetDocument(filename); long documentId = doc != null ? doc.Id : imageHandler.CreateDocument(filename); - //StreamReader stream = new StreamReader(Request.InputStream); - //string x = stream.ReadToEnd(); // added to view content of input stream - - AnnotationInfo annotation = new AnnotationInfo(); //Request.InputStream as AnnotationInfo; + Request.InputStream.Seek(0, SeekOrigin.Begin); + AnnotationInfo annotation = new JsonSerializer().Deserialize(new JsonTextReader(new StreamReader(Request.InputStream))); annotation.DocumentGuid = documentId; CreateAnnotationResult result = imageHandler.CreateAnnotation(annotation); return Content(JsonConvert.SerializeObject( @@ -43,4 +42,5 @@ public ActionResult Post(string file) } } -} \ No newline at end of file +} +