Hi i having one class file asp.net web application in that they are send data using web api Httpclient and Json what i want daily need to expoert data button click what i want by using console or windows service i want to create one setup file while click that class method need to call and execute daily in particualr time any body send that type code console application and how to call that class method
- public static string PreparePost(object input, string fmodulename)
- {
- string res = "";
- string inputJson = "";
- if (fmodulename == "procurementstage")
- {
- inputJson = input.ToString();
- }
- else
- {
- inputJson = (new JavaScriptSerializer()).Serialize(input);
- }
-
- string apiUrl = "http://api/" + fmodulename.ToString().Trim();
-
- apiUrl = ConfigurationManager.AppSettings["bcturl"].ToString() + fmodulename.ToString().Trim();
- HttpClient client = new HttpClient();
- try
- {
- HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json");
- HttpResponseMessage response = client.PostAsync(apiUrl, inputContent).Result;
- if (response.IsSuccessStatusCode)
- {
- res = response.Content.ReadAsStringAsync().Result;
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- return res;
-
- }
like other method also i need to call in