예제 #1
0
        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));
        }
예제 #2
0
        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
            }));
        }
예제 #3
0
        public async Task <MvcHtmlString> DownloadView(SupportServices serviceName, string identity, string uri)
        {
            var baseUrl = Services[serviceName];

            return(await DownloadView(baseUrl, identity, uri));
        }