public HttpResponseMessage ReorderPage(ReorderPageParameters parameters)
        {
            _coreHandler.ReorderPage(parameters);
            var data = new { success = true };

            return(CreateJsonOrJsonpResponse(data, parameters.Callback));
        }
        public override void ProcessRequest(HttpContext context)
        {
            try
            {
                if (!_helper.IsRequestHandlingEnabled(Constants.GroupdocsReorderPageRequestHandlingIsEnabled))
                {
                    return;
                }

                JavaScriptSerializer serializer = new JavaScriptSerializer();
                string json;
                bool   isJsonP = (context.Request.HttpMethod == "GET");

                if (isJsonP)
                {
                    json = context.Request.Params["data"];
                }
                else
                {
                    json = new StreamReader(context.Request.InputStream).ReadToEnd();
                }
                ReorderPageParameters parameters = serializer.Deserialize <ReorderPageParameters>(json);
                ReorderPage(parameters);
                var data = new { succes = true };

                context.Response.ContentType     = "application/json";
                context.Response.ContentEncoding = Encoding.UTF8;
                string serializedData = serializer.Serialize(data);
                CreateJsonOrJsonpResponse(context, serializedData);
            }
            catch (Exception exception)
            {
                OnException(exception, context);
            }
        }
Beispiel #3
0
        public static ReorderPageResponse ReorderPage(ReorderPageParameters parameters)
        {
            string guid = parameters.Path;

            DocumentInfoContainer documentInfoContainer = _imageHandler.GetDocumentInfo(guid);

            int pageNumber  = documentInfoContainer.Pages[parameters.OldPosition].Number;
            int newPosition = parameters.NewPosition + 1;

            ReorderPageOptions reorderPageOptions = new ReorderPageOptions(pageNumber, newPosition);

            _imageHandler.ReorderPage(guid, reorderPageOptions);

            return(new ReorderPageResponse());
        }
Beispiel #4
0
        public ActionResult ReorderPage(ReorderPageParameters parameters)
        {
            string guid = parameters.Path;

            DocumentInfoOptions   documentInfoOptions   = new DocumentInfoOptions(guid);
            DocumentInfoContainer documentInfoContainer = _imageHandler.GetDocumentInfo(documentInfoOptions);

            int pageNumber  = documentInfoContainer.Pages[parameters.OldPosition].Number;
            int newPosition = parameters.NewPosition + 1;

            ReorderPageOptions reorderPageOptions = new ReorderPageOptions(guid, pageNumber, newPosition);

            _imageHandler.ReorderPage(reorderPageOptions);

            return(ToJsonResult(new ReorderPageResponse()));
        }
        public ActionResult ReorderPage(ReorderPageParameters parameters)
        {
            try
            {
                string guid = parameters.Path;

                DocumentInfoContainer documentInfoContainer = _imageHandler.GetDocumentInfo(guid);

                int pageNumber  = documentInfoContainer.Pages[parameters.OldPosition].Number;
                int newPosition = parameters.NewPosition + 1;

                ReorderPageOptions reorderPageOptions = new ReorderPageOptions(pageNumber, newPosition);
                _imageHandler.ReorderPage(guid, reorderPageOptions);

                return(ToJsonResult(new ReorderPageResponse()));
            }
            catch (Exception e)
            {
                return(this.JsonOrJsonP(new FailedResponse {
                    Reason = e.Message
                }, null));
            }
        }
 public ActionResult ReorderPage(ReorderPageParameters parameters)
 {
     _coreHandler.ReorderPage(parameters);
     var data = new { success = true };
     return CreateJsonOrJsonpResponse(data, parameters.Callback);
 }