public virtual string MmsJsonGetCustomer(string mmsEmail, out MmsCustJson mmsCustJson) { mmsCustJson = null; string return_val = null; WebClient myWebClient = new WebClient(); // Create a new NameValueCollection instance to hold some custom parameters to be posted to the URL. NameValueCollection myNameValueCollection = new NameValueCollection(); // Add necessary parameter/value pairs to the name/value container. myNameValueCollection.Add("APIKey", "e252d955a8df2c516fbc74cfbc37bc97"); myNameValueCollection.Add("Email", mmsEmail); //myNameValueCollection.Add("Age", age); // 'The Upload(String,NameValueCollection)' implicitly method sets HTTP POST as the request method. var responseArray = myWebClient.UploadValues("https://downloads.murphysmagic.com/api/GetCustomer/", myNameValueCollection); string rawJson = Encoding.ASCII.GetString(responseArray); if (rawJson.Substring(2, 5) == "error") { MmsJsonError authTest = JsonConvert.DeserializeObject <MmsJsonError>(rawJson); return_val = authTest.error; } else { mmsCustJson = JsonConvert.DeserializeObject <MmsCustJson>(rawJson); return_val = "success"; } return(return_val); }
} // Data_Load public ActionResult TestDownload() { Debug.WriteLine("In TestDownload"); // Create a new WebClient instance. // WebClient myWebClient = new WebClient(); // Create a new NameValueCollection instance to hold some custom parameters to be posted to the URL. // NameValueCollection myNameValueCollection = new NameValueCollection(); // Add necessary parameter/value pairs to the name/value container. // myNameValueCollection.Add("APIKey", "e252d955a8df2c516fbc74cfbc37bc97"); // myNameValueCollection.Add("Email", "*****@*****.**"); // //myNameValueCollection.Add("Age", age); // var responseArray = myWebClient.UploadValues("https://downloads.murphysmagic.com/api/GetCustomer/", myNameValueCollection); // // string rawJson = Encoding.ASCII.GetString(responseArray); // MmsCustJson authTest = JsonConvert.DeserializeObject<MmsCustJson>(rawJson); MmsCustJson mmsCustJson = new MmsCustJson(); var return_string = _mmsAdminService.MmsJsonGetCustomer("*****@*****.**", out mmsCustJson); Debug.WriteLine(return_string); Debug.WriteLine("Cust ID >> " + mmsCustJson.EmailAddress); Debug.WriteLine("Cust ID >> " + mmsCustJson.FirstName); Debug.WriteLine("Cust ID >> " + mmsCustJson.LastName); Debug.WriteLine("Cust ID >> " + mmsCustJson.Password); Debug.WriteLine("Cust ID >> " + mmsCustJson.CustomerId.ToString()); Debug.WriteLine("Cust ID >> " + mmsCustJson.TimeSignedUp.ToString()); Debug.WriteLine("Cust ID >> " + mmsCustJson.Language); return_string = _mmsAdminService.MmsJsonGetCustomer("xxxxx", out mmsCustJson); Debug.WriteLine(return_string); // var mmsIdList = new List <int>(); var return_string2 = _mmsAdminService.MmsJsonGetDownloadsForCustomer("*****@*****.**", out mmsIdList); Debug.WriteLine(return_string2); if (return_string2 == "success") { Debug.WriteLine(mmsIdList[0].ToString()); } return(View("~/Plugins/Misc.PickupInStore2/Views/MmsConfig.cshtml")); }