public async Task <IActionResult> ViewAll() { //if( firstViewAll){ var lines = System.IO.File.ReadLines(@"bigMarkerCreds.env"); ViewData["Message"] = "Hello there, List of Conferences:"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.bigmarker.com/api/v1/conferences/"); request.Headers["API-KEY"] = lines.ElementAt(0).ToString(); request.Method = "GET"; //Gettin the response var response = await request.GetResponseAsync(); var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); //Converting the response to Json Onbject JObject joResponse = JObject.Parse(responseString); var ConferencesArray = (JArray)joResponse["conferences"]; //Adding the conferences to the repository foreach (JObject conf in ConferencesArray) { ConferencesRepo.add(new Conference(conf)); } ViewData["respString"] = responseString; firstViewAll = false; // } //return View(); //return RedirectToLocal(returnUrl); return(View()); }
public async Task <IActionResult> Delete(string ValueIneed) { using (var client = new HttpClient()) { var lines = System.IO.File.ReadLines(@"zoom2.env"); var values = new Dictionary <string, string> { { "api_key", lines.ElementAt(0).ToString() }, { "api_secret", lines.ElementAt(1).ToString() }, { "host_id", lines.ElementAt(2).ToString() }, { "id", ValueIneed } }; var content = new FormUrlEncodedContent(values); var response = await client.PostAsync("https://api.zoom.us/v1/Conference/delete", content); //var responseString = await response.Content.ReadAsStringAsync(); //JObject joResponse = JObject.Parse(responseString); //var startUrl = joResponse["start_url"].ToString(); //ConferencesRepo.add(new Conference(joResponse)); } ViewData["Message"] = "Meetig with id " + ValueIneed + " will be removed"; ConferencesRepo.removeByID(ValueIneed); return(RedirectToLocal(null)); //return View(); }