// Gets the user info (Logs them in) public async Task <IUser> GetUser(string uName, string password, HomePage.ErrorHandling errorMessage) { // Checks connection bool connection = _checkConnection.hasConnection(errorMessage); if (connection) { // Grabs the user info by their username and password IUser user = await _userProxy.GetUser(errorMessage, uName, password); if (user != null) // Checks that its not null { // If they want their details to be remembered it saves the data locally if (await Storage.ReadTextFileAsync(App.detailsLocation, errorMessage) == "true") { await Storage.WriteTextFileAsync(App.uNameLocation, user.UName, errorMessage); await Storage.WriteTextFileAsync(App.pwrdLocation, user.Pwrd, errorMessage); } return(user); // Return the user } else { return(null); } } else { return(null); } }
//An asynchronous Task which takes in the info which is sent to proxy method, API call made to get user in db if exists public async Task <IUser> Login(string uname, string pword) { return(await _userProxy.GetUser(uname, pword)); }