Skip to content
This repository was archived by the owner on Oct 18, 2018. It is now read-only.

Commit 06b0664

Browse files
committed
Fix error when annotation is added
1 parent ef0dbb7 commit 06b0664

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

GroupDocs.Annotation for .NET/Controllers/AddAnnotationController.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Newtonsoft.Json.Serialization;
99
using System;
1010
using System.Collections.Generic;
11+
using System.IO;
1112
using System.Linq;
1213
using System.Web;
1314
using System.Web.Mvc;
@@ -29,10 +30,8 @@ public ActionResult Post(string file)
2930
Document doc = documentDataHandler.GetDocument(filename);
3031
long documentId = doc != null ? doc.Id : imageHandler.CreateDocument(filename);
3132

32-
//StreamReader stream = new StreamReader(Request.InputStream);
33-
//string x = stream.ReadToEnd(); // added to view content of input stream
34-
35-
AnnotationInfo annotation = new AnnotationInfo(); //Request.InputStream as AnnotationInfo;
33+
Request.InputStream.Seek(0, SeekOrigin.Begin);
34+
AnnotationInfo annotation = new JsonSerializer().Deserialize<AnnotationInfo>(new JsonTextReader(new StreamReader(Request.InputStream)));
3635
annotation.DocumentGuid = documentId;
3736
CreateAnnotationResult result = imageHandler.CreateAnnotation(annotation);
3837
return Content(JsonConvert.SerializeObject(
@@ -43,4 +42,5 @@ public ActionResult Post(string file)
4342

4443
}
4544
}
46-
}
45+
}
46+

0 commit comments

Comments
 (0)