public void Get_User_Should_Return_Test_User() { var db = new xmasDB(); var test = new User { Username = USERNAME, Password = USERPASSWORD }; var user = db.GetUser(test); Assert.IsNotNull(user); }
public ActionResult Login(User user) { xmasDB db = new xmasDB(); var usr = db.GetUser(user); if (usr != null) { Session["Email"] = usr.Email.ToString(); Session["UserID"] = usr.Id.ToString(); Session["Username"] = usr.Username.ToString(); if (usr.IsAdmin) { Session["IsAdmin"] = usr.IsAdmin.ToString(); } return(RedirectToAction($"../Home")); } else { ModelState.AddModelError("", "Email or password incorrect"); } return(View()); }