private static User CreateUser() { Console.WriteLine("Please enter your name: "); var name = Console.ReadLine(); User user = _sql.ReadOneUser(name.Trim()); if (user == null) { user = new User(); user.Name = name.Trim(); _sql.SaveUser(user); } Console.WriteLine(user); return(user); }
public static User CreateUser(bool temporary) { User n = new User(); if (temporary) { n.temporary = true; return(n); } else { Console.WriteLine("\nPlease input your desired username"); string s = Console.ReadLine(); Console.WriteLine("\nThe username you typed is: " + s + "\nIs this acceptable? (Y/N)"); if (YesNo()) { n.Name = s; _sql.Save(n); n = _sql.ReadOneUser(s); Console.WriteLine($"\nThank you for creating an account with us! \nYour User ID is {n.Id} and your Username is {s}"); return(n); } else { return(CreateUser(false)); } } }
void UserView() { User = _sql.ReadOneUser("First"); UpdateMainUSer(); bool StillInSwitch = true; int UserInput; // list all the stores the user can choose from and allows user to choose a store PrintAllStores(); UserSelectStore(); while (StillInSwitch) { Console.WriteLine("1.Create and modify an order\n" + "2.View Order History\n" + "3.Select a new Store\n4.Exit"); UserInput = int.Parse(Console.ReadLine()); switch (UserInput) { case 1: UserModifyOrder(); break; case 2: User.ListOrderHistory(); break; case 3: PrintAllStores(); UserSelectStore(); break; case 4: StillInSwitch = false; break; } } }