public IActionResult SignUp(string Email, string Pass) { var user = new Login(Email, Pass); HttpContext.Session.SetString("User", user.Email); repoUser.Save(user); return(RedirectToAction("Order", "Order")); }
internal static void LogIn(out User user) { Console.WriteLine("Welcome to pizzaBox"); Console.Write("Are you new Here(Y/N)?"); string input = Console.ReadLine(); input.ToLowerInvariant(); if (input == "y") { Console.WriteLine("Are you new here."); Console.Write("What is your Email? "); string userName = Console.ReadLine(); Console.Write("I need a good password? "); string password = Console.ReadLine(); user = new User(userName, password); repoUser.Save(user); try{ }catch (Microsoft.EntityFrameworkCore.DbUpdateException) { Console.WriteLine("Please try again."); LogIn(out user); } return; } else if (input == "n") { Console.WriteLine("welcome back"); Console.Write("Email? "); string email = Console.ReadLine(); Console.Write("Password? "); string pass = Console.ReadLine(); user = new User(email, pass); if (repoUser.CheckUser(user)) { return; } else { LogIn(out user); } } else { Console.WriteLine("Wrong Password or Email"); LogIn(out user); } }