public ActionResult Login(Login login) { using (var context = new StripeEntities()) { var loginCheck = context.SP_LOGIN(login.login_username, login.login_password).SingleOrDefault(); if (loginCheck == null) { ModelState.AddModelError("", "Log in credentials invalid"); return View(login); } else { FormsAuthentication.SetAuthCookie(loginCheck.login_username, false); Session["loginid"] = loginCheck.login_ID; switch (loginCheck.User_Type_userType_ID) { case "R": return RedirectToAction("Home", "Referee"); break; case "S": return RedirectToAction("Home", "Director"); break; case "A": return RedirectToAction("Home", "Admin", new { id = loginCheck.login_ID }); break; default: return RedirectToAction("Index", "Home"); break; } } } }
public ActionResult SignUp(Login login) { using (var context = new StripeEntities()) { EncryptDecrypt encrypt = new EncryptDecrypt(); login.login_random_string = encrypt.Encrypt(login.login_username, "r0b1nr0y"); context.Logins.Add(login); context.SaveChanges(); return View("SignUpConfirmation"); } }