public ActionResult Register(string registerUsername, string registerPassword, string firstname, string lastname, DateTime dateOfBirth, string email) { /*string registerUsername, string registerPassword, string firstname, string lastname, string dateOfBirth, string email*/ var userLogic = new Userlogic(_personContext); userLogic.AddUser(registerUsername, registerPassword, firstname, lastname, dateOfBirth, email, DateTime.Now.Date); return(RedirectToAction("Index", "Home")); }
public ActionResult Login(string loginUsername, string loginPassword) { var userLogic = new Userlogic(_personContext); foreach (var user in userLogic.GetAllUsers()) { if (user.Username == loginUsername && user.Password == loginPassword) { HttpContext.Session.SetString("Username", user.Username); HttpContext.Session.SetInt32("UserID", user.ID); return(RedirectToAction("Index", "Home")); } } ModelState.AddModelError("LogOnError", "The username or password provided is incorrect."); return(RedirectToAction("Index", "Login")); }