public AspNetUsers ValidateLogin(string userName, string password) { if (SettingHelpers.CheckConnection()) { var httpClient = new HttpClients(); MerchantService.Repository.ApplicationClasses.LoginViewModel loginViewController = new MerchantService.Repository.ApplicationClasses.LoginViewModel(); loginViewController.UserName = userName; loginViewController.Password = password; string jsonString = JsonConvert.SerializeObject(loginViewController); var httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json"); var response = httpClient.PutAsync("api/poslogin/validatelogin", httpContent); if (response.IsSuccessStatusCode) { var aspNetUser = response.Content.ReadAsAsync <MerchantService.Repository.ApplicationClasses.AspNetUsers>().Result; if (aspNetUser != null) { AddOrUpdateUserDataInLocalDb(userName, password, aspNetUser.Id); } return(aspNetUser); } } else { var user = _userLogin.FirstOrDefault(x => x.Password == password && x.Username == userName); if (user != null) { return(new MerchantService.Repository.ApplicationClasses.AspNetUsers() { Id = user.UserId, UserName = user.Username }); } } return(null); }