Пример #1
0
        internal static Education FromJson(VkResponse response)
        {
            if (response["university"] == null || response["university"].ToString() == "0")
                return null;

            var education = new Education();

            education.UniversityId = Utilities.GetNullableLongId(response["university"]);
            education.UniversityName = response["university_name"];
            education.FacultyId = Utilities.GetNullableLongId(response["faculty"]);
            education.FacultyName = response["faculty_name"];
            education.Graduation = (int?) Utilities.GetNullableLongId(response["graduation"]);

            if (education.UniversityId.HasValue && education.UniversityId == 0)
                education.UniversityId = null;

            if (education.FacultyId.HasValue && education.FacultyId == 0)
                education.FacultyId = null;

            if (education.Graduation.HasValue && education.Graduation == 0)
                education.Graduation = null;

            education.EducationForm = response["education_form"]; // установлено экcпериментальным путем
            education.EducationStatus = response["education_status"]; // установлено экcпериментальным путем

            return education;
        }
Пример #2
0
        /// <summary>
        /// Разобрать из json.
        /// </summary>
        /// <param name="response">Ответ сервера.</param>
        /// <returns></returns>
        public static Education FromJson(VkResponse response)
        {
            if (response["university"] == null || response["university"].ToString() == "0")
            {
                return(null);
            }

            var education = new Education
            {
                UniversityId   = Utilities.GetNullableLongId(response["university"]),
                UniversityName = response["university_name"],
                FacultyId      = Utilities.GetNullableLongId(response["faculty"]),
                FacultyName    = response["faculty_name"],
                Graduation     = (int?)Utilities.GetNullableLongId(response["graduation"])
            };

            if (education.UniversityId.HasValue && education.UniversityId == 0)
            {
                education.UniversityId = null;
            }

            if (education.FacultyId.HasValue && education.FacultyId == 0)
            {
                education.FacultyId = null;
            }

            if (education.Graduation.HasValue && education.Graduation == 0)
            {
                education.Graduation = null;
            }

            education.EducationForm   = response["education_form"];           // установлено экcпериментальным путем
            education.EducationStatus = response["education_status"];         // установлено экcпериментальным путем

            return(education);
        }