public static String getGroupName(Group gr) { WebClient wc = new WebClient(); wc.Encoding = Encoding.UTF8; String answer = wc.DownloadString("https://api.vk.com/method/groups.getById?group_id=" + gr.ID_GROUP); JObject obj = JObject.Parse(answer); JToken jtoken = obj["response"].First["name"]; return jtoken.ToString(); }
public RedirectResult addGroup(string groupId) { int userId = getUserId(); int accId = db.SocAccounts.Where(s => s.ID_USER == userId && s.SOCNET_TYPE == 0).Select(s => s.ID_AC).Single(); Group group = new Group(groupId, accId); db.Groups.Add(group); db.SaveChanges(); return Redirect("/Tool/SocStudio"); }