public async Task <ServiceResponse> BotAuthentication(string loginID, string password)
        {
            string     url  = ConfigurationManager.AppSettings["url"];
            HttpClient cons = new HttpClient();

            cons.BaseAddress = new Uri(url);
            cons.DefaultRequestHeaders.Accept.Clear();
            cons.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
            var tag = new BotAuthenticationModal {
                loginID = loginID, password = password
            };

            try
            {
                string      req     = JsonConvert.SerializeObject(tag);
                HttpContent content = new StringContent(tag.ToString(), Encoding.UTF8, "application/json");

                HttpResponseMessage res = cons.PostAsync(url + "api/BotAuthentication/BotAuthenticationDetails", new StringContent(@"{""RequestJSON"":" + req + "}", Encoding.Default, "application/json")).Result;
                var data = await res.Content.ReadAsAsync <ServiceResponse>();

                //var login = data.ResponseJSON;
                return(data);
            }
            catch (Exception ex)
            {
                WriteLogFile(new StringBuilder(ex.Message + " " + ex.InnerException != null ? ex.InnerException.InnerException.Message : ""));
                return(new ServiceResponse());
            }
        }
Ejemplo n.º 2
0
        public IHttpActionResult BotAuthenticationDetails(BotAuthenticationModal id)
        {
            BotAuthenticationRepository sa = new BotAuthenticationRepository();
            var r = sa.GetLoginDetails(id.loginID, id.password);

            var response = WebMethods.CreateServiceResponse(Enums.WebServiceStatus.Success, r);

            return(Json(response));
        }