private bool isValid(string username,string password) { bool isValid = false; Repo.UserRepo userRepo = new Repo.UserRepo(); var user = userRepo.GetUsers().FirstOrDefault(u => u.username == username && u.passwordhash == password); if (user != null) { isValid = true; } return isValid; }
public ActionResult Register(Models.UserModel user) { if (ModelState.IsValid) { Repo.UserRepo userRepo = new Repo.UserRepo(); userRepo.CreateUser(user.username,user.passwordhash); return RedirectToAction("Login", "User"); } return View(user); }