Пример #1
0
        private static HttpResponseMessage ClientPostRequest(string RequestURI, SoftwareDeatils sDetails)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://epmschatbotapi.azurewebsites.net");
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            HttpResponseMessage response = client.PostAsJsonAsync(RequestURI, sDetails).Result;

            return(response);
        }
Пример #2
0
        //----post method-------------------
        static string SaveSoftwareHelpDesk(string empCode, string tickettype, string cat, string dec, string attFName, string attFData, string Softwarestarttime, string Softwareendtime)
        {
            string responseString = "";

            SoftwareDeatils sDetails = new SoftwareDeatils()
            {
                EmpCode = empCode, TicketType = tickettype, Category = cat, Description = dec, AttFileName = attFName, AttFileDataURL = attFData, ActionStartTime = Softwarestarttime, ActionEndTime = Softwareendtime
            };
            HttpResponseMessage responsePostMethod = ClientPostRequest("api/SoftwareHelpDesk/SaveSoftwareHelpDesk", sDetails);

            if (responsePostMethod.IsSuccessStatusCode)
            {
                responseString = responsePostMethod.Content.ReadAsStringAsync().Result;
            }
            return(responseString);
        }
Пример #3
0
        //----------get method---------------
        static string GetCategory(string empCode)
        {
            string responseString = "";

            SoftwareDeatils sDetails = new SoftwareDeatils()
            {
                EmpCode = empCode
            };
            HttpResponseMessage responsePostMethod = GetClientRequest("api/SoftwareHelpDesk/GetCategory", sDetails);

            if (responsePostMethod.IsSuccessStatusCode)
            {
                responseString = responsePostMethod.Content.ReadAsStringAsync().Result;
            }
            return(responseString);
        }