Exemple #1
0
        public async Task <User> LoginAsync(string userName, string password)
        {
            try
            {
                var result = await _loginApi.LoginAsync(userName, password);

                if (result?.Status == "success")
                {
                    var user = new User
                    {
                        Name     = userName,
                        Password = password
                    };
                    _userRepository.SaveUser(user);
                    return(user);
                }
                else
                {
                    return(null);
                }
            }
            catch (NoInternetConnectionException)
            {
                return(null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public async Task <bool> LoginAsync(string user, string pass)
 {
     return(await loginApi.LoginAsync(user, pass));
 }