// consumir servicio login public void CallServiceGetLoginUser() { #region metodos //madamos a llamar el metodo que serializa list de pocos string dataUser = GetJonUser(); if (!String.IsNullOrEmpty(dataUser)) { try { var client = new RestClient(routeLogin); client.Authenticator = new HttpBasicAuthenticator(basicAuthUser, basicAuthPass); var request = new RestRequest(Method.POST); request.Resource = nameService; request.RequestFormat = RestSharp.DataFormat.Json; request.AddHeader("Content-type", "application/json"); request.AddBody(new { dataUser = dataUser }); IRestResponse response = client.Execute(request); Dictionary <string, string> resx = dataMapper.GetResponseDictionary(response.Content); bool list; list = dataMapper.GetDeserializeUsuarioBool(resx["GetLoginResult"]); if (list != false) { this.Login = list; if (this.Login) { AppUsuario app = new AppUsuario(); app.ChangeUser(this.Usuario.USUARIO_MAIL); } } else { this.Login = list; } } catch (Exception) { this.Login = false; } } else { this.Login = false; } #endregion }
public bool GetLoginUser() { bool res = false; res = dataMapper.GetElementLoginLocal(this._Usuario); this.Login = res; if (this.Login) { AppUsuario app = new AppUsuario(); app.ChangeUser(this.Usuario.USUARIO_MAIL); } return(res); }