public void updateUserBalance(TuscUser loggedInUser) { if (loggedInUser != null) { foreach (var user in this.UserList) { if (user.Name == loggedInUser.Name && user.Pwd == loggedInUser.Password) { user.Bal = loggedInUser.Balance; } } } }
public TuscUser getValidUser(string userName, string password) { TuscUser tuscUser = null; foreach (var user in this.UserList) { if (user.Name == userName && user.Pwd == password) { tuscUser = new TuscUser(); tuscUser.Name = userName; tuscUser.Password = password; tuscUser.Balance = user.Bal; } } return tuscUser; }
private void logIn() { while (loggedInUser == null) { string name = promptForUserName(); if (!string.IsNullOrEmpty(name)) { string pwd = GetUserInputFromConsole("Enter Password:"******"\nYou entered an invalid username or password.", ConsoleColor.Red); } } }
public void updateUser(TuscUser loggedInUser) { this.Users.updateUserBalance(loggedInUser); }
public Tusc(DataStore dataStoreIn) { this.dataStore = dataStoreIn; this.loggedInUser = null; }
private static void showPurchaseMessage(List<Product> prods, TuscUser loggedInUser, int productIndex, int qty) { Console.Clear(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("You bought " + qty + " " + prods[productIndex].Name); Console.WriteLine("Your new balance is " + loggedInUser.Balance.ToString("C")); Console.ResetColor(); }