public bool DeleteLogin(Models.Login login) { Login l = new Login(); allLogins.TryRemove(login.Username,out l); Save(); return (l != null); }
public ActionResult Autherize(Project.Models.Login login) { UserDBHandle dbb = new UserDBHandle(); using (OOSEPROJECTEntities db = new OOSEPROJECTEntities()) { var user = db.Logins.Where(x => x.UserName == login.UserName && x.UserPassword == login.UserPassword).FirstOrDefault(); var userDetails = dbb.GetLogins().Find(smodel => smodel.ID == user.UserID); if (user == null) { login.LoginErrorMessage = "Wrong Username or Password"; return(View("Index", login)); } else if (userDetails.UserType == "admin") { Session["userID"] = user.UserID; Session["userName"] = user.UserName; Session["userType"] = userDetails.UserType; return(RedirectToAction("Index", "Home")); } else if (userDetails.UserType == "customer") { Session["userID"] = user.UserID; Session["userName"] = user.UserName; Session["userType"] = userDetails.UserType; return(RedirectToAction("IndexC", "Home")); } else if (userDetails.UserType == "employee") { Session["userID"] = user.UserID; Session["userName"] = user.UserName; Session["userType"] = userDetails.UserType; return(RedirectToAction("IndexE", "Home")); } else { login.LoginErrorMessage = "Enter valid type!"; return(View("Index", login)); } } }
public void SetSuccessLogin(Models.Login login) { login = GetLoginByID(login.Username); Models.Login newLogin = new Login() { SuccessLoginDate = DateTime.Now.ToString(), Username = login.Username }; allLogins.TryUpdate(login.Username, newLogin,login); Save(); }