Пример #1
0
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var role = new Role();

                role.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                role.Name = dictionary.GetValue<string>(RedmineKeys.NAME);

                var permissions = dictionary.GetValue<ArrayList>(RedmineKeys.PERMISSIONS);
                if (permissions != null)
                {
                    role.Permissions = new List<Permission>();
                    foreach (var permission in permissions)
                    {
                        var perms = new Permission() { Info = permission.ToString() };
                        role.Permissions.Add(perms);
                    }

                }

                return role;
            }
            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var permission = new Permission { Info = dictionary.GetValue<string>("permission") };
                return permission;
            }

            return null;
        }