public ActionResult Login(User user, bool rememberMe = false) { User userToCheck = _userService.GetByUserNameAndPassword(user); if (userToCheck == null) { TempData.Add("Message", "This is not a valid username and password"); return View(); } FormsAuthentication.SetAuthCookie(user.UserName, rememberMe); return RedirectToAction("Index", "Product"); }
public User GetByUserNameAndPassword(User user) { return _userDal.Get(u => u.UserName == user.UserName && u.Password == user.Password); }