コード例 #1
0
 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");
 }
コード例 #2
0
 public User GetByUserNameAndPassword(User user)
 {
     return _userDal.Get(u => u.UserName == user.UserName && u.Password == user.Password);
 }