public T GetMenuTemplates <T>(SupportServices serviceName, string identity, string uri) { var baseAddress = Services[serviceName]; var handler = new HttpClientHandler() { CookieContainer = new CookieContainer() }; _identityHandler.SetIdentity(handler, baseAddress, identity); var client = new HttpClient(handler) { BaseAddress = baseAddress }; AddCustomHeaders(client); string content = null; try { var response = client.GetAsync(uri).ConfigureAwait(false).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { content = response.Content.ReadAsStringAsync().Result; } } catch (Exception e) { Console.WriteLine(e); } return(content != null?JsonConvert.DeserializeObject <T>(content) : default(T)); }
public JsonResult Help(string Email, string Message) { SupportServices SuppServ = new SupportServices(); var resp = SuppServ.Help(Email, Message); if (resp.Status == Status.Success) { resp.Message = App_LocalResources.Support.HelpServiceConfirmed; } else { resp.Status = Status.Warning; resp.Message = App_LocalResources.Support.HelpServiceNotAvailable; } return(Json(new { Data = resp })); }
public async Task <MvcHtmlString> DownloadView(SupportServices serviceName, string identity, string uri) { var baseUrl = Services[serviceName]; return(await DownloadView(baseUrl, identity, uri)); }