public ActionResult Register(Customer inCustomer) { if (ModelState.IsValid) { using (var db = new DatabaseContext()) { SecurityImplementation.RegisterImplementation(inCustomer); } return(RedirectToAction("Login", "Security")); } return(View()); }
public ActionResult Login(LoginCustomer LoggedIn) { if (ModelState.IsValid) { if (SecurityImplementation.User_in_DB(LoggedIn)) { // Username && Password correct Session["LoggedIn"] = "true"; //Sesion to store username Session["Username"] = LoggedIn.Username; // ViewBag.InLogged = true; return(RedirectToAction("Index", "Home")); } else { // Username && Password wrong Session["LoggedIn"] = "false"; // ViewBag.InLogged = false; return(View("LoginFailed")); } } // Check to see if Login Credentials are OK return(View()); }