/// <summary> /// Разобрать из json. /// </summary> /// <param name="response">Ответ сервера.</param> /// <returns></returns> internal static GroupsEditParams FromJson(VkResponse response) { var marketCountry = (VkResponseArray)response["market_country"]; var marketCity = (VkResponseArray)response["market_city"]; var result = new GroupsEditParams { GroupId = response["group_id"] ?? 0UL, Title = response["title"], Description = response["description"], ScreenName = response["screen_name"], Access = response["access"], Website = response["website"], Subject = response["seubject"], Email = response["email"], Phone = response["phone"], Rss = response["rss"], EventStartDate = response["event_start_date"], EventFinishDate = response["event_finish_date"], EventGroupId = response["event_group_id"], PublicCategory = response["public_category"], PublicSubcategory = response["public_subcategory"], PublicDate = response["public_date"], Wall = response["wall"], Topics = response["topics"], Photos = response["photos"], Video = response["video"], Audio = response["audio"], Links = response["links"], Events = response["events"], Places = response["places"], Contacts = response["contacts"], Docs = response["docs"], Wiki = response["wiki"], Messages = response["messages"], AgeLimits = response["age_limits"], Market = response["market"], MarketComments = response["market_comments"], MarketCountry = marketCountry.ToCollectionOf <ulong>(o => o), MarketCity = marketCity.ToCollectionOf <ulong>(o => o), MarketCurrency = response["market_currency"], MarketContact = response["market_contact"], MarketWiki = response["market_wiki"], ObsceneFilter = response["obscene_filter"], ObsceneStopwords = response["obscene_stopwords"], ObsceneWords = response["obscene_words"].ToReadOnlyCollectionOf <string>(o => o) }; return(result); }
/// <summary> /// Привести к типу VkParameters. /// </summary> /// <param name="p">Параметры.</param> /// <returns>Объект типа <see cref="GroupsEditParams"/></returns> internal static VkParameters ToVkParameters(GroupsEditParams p) { var result = new VkParameters { { "group_id", p.GroupId }, { "title", p.Title }, { "description", p.Description }, { "screen_name", p.ScreenName }, { "access", p.Access }, { "website", p.Website }, { "subject", p.Subject }, { "email", p.Email }, { "phone", p.Phone }, { "rss", p.Rss }, { "event_start_date", p.EventStartDate }, { "event_finish_date", p.EventFinishDate }, { "event_group_id", p.EventGroupId }, { "public_category", p.PublicCategory }, { "public_subcategory", p.PublicSubcategory }, { "public_date", p.PublicDate }, { "wall", p.Wall }, { "topics", p.Topics }, { "photos", p.Photos }, { "video", p.Video }, { "audio", p.Audio }, { "links", p.Links }, { "events", p.Events }, { "places", p.Places }, { "contacts", p.Contacts }, { "docs", p.Docs }, { "wiki", p.Wiki }, { "messages", p.Messages }, { "age_limits", p.AgeLimits }, { "market", p.Market }, { "market_comments", p.MarketComments }, { "market_country", p.MarketCountry }, { "market_city", p.MarketCity }, { "market_currency", p.MarketCurrency }, { "market_contact", p.MarketContact }, { "market_wiki", p.MarketWiki }, { "obscene_filter", p.ObsceneFilter }, { "obscene_stopwords", p.ObsceneStopwords }, { "obscene_words", p.ObsceneWords } }; return(result); }