using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace SuperAdmin.Models.Object { public class UserProfile : Posting { public String id { get; set; } public String usersId { get; set; } public String users { get; set; } //public String serviceid { get; set; } public String fullName { get; set; } public String sex { get; set; } public String address { get; set; } public String provinceId { get; set; } public String cardNumber { get; set; } public String email { get; set; } public String company { get; set; } public String description { get; set; } public String picture { get; set; } public String sexNeed { get; set; } public String birthday { get; set; } public String birthday_day { get; set; } public String birthday_month { get; set; } public String birthday_year { get; set; } public String height { get; set; } public String weight { get; set; } public String work { get; set; } public String isLike { get; set; } public String totalLike { get; set; } public String totalPic { get; set; } public String totalView { get; set; } public String lookingFor { get; set; } public List listInterests { get; set; } public String interests { get; set; } public UserProfile() { } public UserProfile(string json) : this(JObject.Parse(json)) { } public UserProfile(JObject jObject) { if (jObject != null) { id = (string)jObject["id"]; usersId = (string)jObject["usersId"]; users = (string)jObject["users"]; //serviceid = (string)jObject["serviceid"]; fullName = (string)jObject["fullName"]; sex = (string)jObject["sex"]; address = (string)jObject["address"]; provinceId = (string)jObject["provinceId"]; cardNumber = (string)jObject["cardNumber"]; email = (string)jObject["email"]; company = (string)jObject["company"]; description = (string)jObject["description"]; picture = (string)jObject["picture"]; sexNeed = (string)jObject["sexNeed"]; birthday = (string)jObject["birthday"]; if (birthday != null && birthday != "") { birthday_day = birthday.Substring(0, 2); birthday_month = birthday.Substring(3, 2); birthday_year = birthday.Substring(6); } height = (string)jObject["height"]; weight = (string)jObject["weight"]; work = (string)jObject["work"]; isLike = (string)jObject["isLike"]; totalLike = (string)jObject["totalLike"]; totalPic = (string)jObject["totalPic"]; totalView = (string)jObject["totalView"]; lookingFor = (string)jObject["lookingFor"]; var list = jObject["listInterests"]; if (list != null && list.HasValues) { listInterests = new List(); JArray a = (JArray)list; foreach (JObject o in a.Children()) { listInterests.Add(new Interest(o)); } } } } } public class Interest { public String id { get; set; } public String code { get; set; } public String name { get; set; } public String picture { get; set; } public Interest() { } public Interest(JObject jObject) { if (jObject != null) { id = (string)jObject["id"]; code = (string)jObject["code"]; name = (string)jObject["name"]; picture = (string)jObject["picture"]; } } } }