protected override void Serialize(IDictionary <string, object> json)
        {
            var read = Read.ToJson();

            if (Prefix.HasValue())
            {
                json["prefix"] = Prefix;
            }

            if (read.Keys.Any())
            {
                json["read"] = read;
            }

            var update = Update.ToJson();

            if (update.Keys.Any())
            {
                json["update"] = update;
            }

            var create = Create.ToJson();

            if (create.Keys.Any())
            {
                json["create"] = create;
            }

            var destroy = Destroy.ToJson();

            if (destroy.Keys.Any())
            {
                json["destroy"] = destroy;
            }
        }
Exemple #2
0
        protected override void Serialize(System.Collections.Generic.IDictionary <string, object> json)
        {
            if (Filter != DefaultFilter)
            {
                json["filter"] = Filter;
            }

            var messages = this.messages.ToJson();

            if (messages.Any())
            {
                json["messages"] = messages;
            }

            var read = Read.ToJson();

            if (read.Any())
            {
                var transport = new Dictionary <string, object>();
                json["transport"] = transport;

                transport["read"] = read;
                transport["type"] = "imagebrowser-aspnetmvc";

                var thumbnail = Thumbnail.ToJson();
                if (thumbnail.Any())
                {
                    transport["thumbnailUrl"] = thumbnail["url"];
                }

                var upload = Upload.ToJson();
                if (upload.Any())
                {
                    transport["uploadUrl"] = upload["url"];
                }

                var destroy = Destroy.ToJson();
                if (destroy.Any())
                {
                    transport["destroy"] = destroy;
                }

                var create = Create.ToJson();
                if (create.Any())
                {
                    transport["create"] = create;
                }

                var image = Image.Url;
                if (image.HasValue())
                {
                    image = Regex.Replace(image, "(%20)*%7B0(%20)*", "{0", RegexOptions.IgnoreCase);
                    image = Regex.Replace(image, "(%20)*%7D(%20)*", "}", RegexOptions.IgnoreCase);
                    transport["imageUrl"] = image;
                }
            }
        }
Exemple #3
0
        protected override void Serialize(IDictionary <string, object> json)
        {
            if (CustomRead != null)
            {
                json["read"] = CustomRead;
            }
            else if (FunctionRead.HasValue())
            {
                json["read"] = FunctionRead;
            }
            else
            {
                var read = Read.ToJson();
                if (read.Keys.Any())
                {
                    json["read"] = read;
                }
            }

            if (SerializeEmptyPrefix)
            {
                json["prefix"] = Prefix.HasValue() ? Prefix : string.Empty;
            }
            else if (Prefix.HasValue())
            {
                json["prefix"] = Prefix;
            }

            if (CustomUpdate != null)
            {
                json["update"] = CustomUpdate;
            }
            else if (FunctionUpdate.HasValue())
            {
                json["update"] = FunctionUpdate;
            }
            else
            {
                var update = Update.ToJson();

                if (update.Keys.Any())
                {
                    json["update"] = update;
                }
            }

            if (CustomCreate != null)
            {
                json["create"] = CustomCreate;
            }
            else if (FunctionCreate.HasValue())
            {
                json["create"] = FunctionCreate;
            }
            else
            {
                var create = Create.ToJson();

                if (create.Keys.Any())
                {
                    json["create"] = create;
                }
            }

            if (CustomDestroy != null)
            {
                json["destroy"] = CustomDestroy;
            }
            else if (FunctionDestroy.HasValue())
            {
                json["destroy"] = FunctionDestroy;
            }
            else
            {
                var destroy = Destroy.ToJson();

                if (destroy.Keys.Any())
                {
                    json["destroy"] = destroy;
                }
            }

            if (StringifyDates)
            {
                json["stringifyDates"] = StringifyDates;
            }

            if (!string.IsNullOrEmpty(IdField))
            {
                json["idField"] = IdField;
            }

            if (ParameterMap.HasValue())
            {
                json["parameterMap"] = ParameterMap;
            }

            var signalR = SignalR.ToJson();

            if (signalR.Keys.Any())
            {
                json["signalr"] = signalR;
            }
        }