/// <summary> /// Привести к типу VkParameters. /// </summary> /// <param name="p">Параметры.</param> /// <returns>Объект типа <see cref="AccountSaveProfileInfoParams"/></returns> internal static VkParameters ToVkParameters(AccountSaveProfileInfoParams p) { if (p.RelationPartner != null) { VkErrors.ThrowIfNumberIsNegative(() => p.RelationPartner.Id); } if (p.Country != null) { VkErrors.ThrowIfNumberIsNegative(() => p.Country.Id); } if (p.City != null) { VkErrors.ThrowIfNumberIsNegative(() => p.City.Id); } var result = new VkParameters { { "first_name", p.FirstName }, { "last_name", p.LastName }, { "maiden_name", p.MaidenName }, { "screen_name", p.ScreenName }, { "sex", p.Sex }, { "relation", p.Relation }, { "relation_partner_id", p.RelationPartner?.Id }, { "bdate", p.BirthDate }, { "bdate_visibility", p.BirthdayVisibility }, { "home_town", p.HomeTown }, { "country_id", p.Country?.Id }, { "city_id", p.City?.Id }, { "status", p.Status }, { "phone", p.Phone } }; return(result); }
public bool SaveProfileInfo(string firstName = null, string lastName = null, string maidenName = null, Sex? sex = null, RelationType? relation = null, long? relationPartnerId = null, DateTime? birthDate = null, BirthdayVisibility? birthDateVisibility = null, string homeTown = null, long? countryId = null, long? cityId = null) { ChangeNameRequest request; var parameters = new AccountSaveProfileInfoParams { FirstName = firstName, LastName = lastName, MaidenName = maidenName, Sex = sex.Value, Relation = relation.Value, RelationPartner = relationPartnerId.HasValue ? new User { Id = relationPartnerId.Value } : null, BirthDate = birthDate?.ToShortDateString(), BirthdayVisibility = birthDateVisibility.Value, HomeTown = homeTown, Country = new Country { Id = countryId }, City = new City { Id = cityId } }; return SaveProfileInfo(out request, parameters); }
/// <summary> /// Привести к типу VkParameters. /// </summary> /// <param name="p">Параметры.</param> /// <returns>Объект типа <see cref="AccountSaveProfileInfoParams"/></returns> internal static VkParameters ToVkParameters(AccountSaveProfileInfoParams p) { if (p.RelationPartner != null) { VkErrors.ThrowIfNumberIsNegative(() => p.RelationPartner.Id); } if (p.Country != null) { VkErrors.ThrowIfNumberIsNegative(() => p.Country.Id); } if (p.City != null) { VkErrors.ThrowIfNumberIsNegative(() => p.City.Id); } var result = new VkParameters { { "first_name", p.FirstName }, { "last_name", p.LastName }, { "maiden_name", p.MaidenName }, { "screen_name", p.ScreenName }, { "sex", p.Sex }, { "relation", p.Relation }, { "relation_partner_id", p.RelationPartner?.Id }, { "bdate", p.BirthDate }, { "bdate_visibility", p.BirthdayVisibility }, { "home_town", p.HomeTown }, { "country_id", p.Country?.Id }, { "city_id", p.City?.Id }, { "status", p.Status }, { "phone", p.Phone } }; return result; }