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");
 }
Esempio n. 2
0
 public User GetByUserNameAndPassword(User user)
 {
     return _userDal.Get(u => u.UserName == user.UserName && u.Password == user.Password);
 }