Пример #1
0
        public User SignIn(SigninView signinView)
        {
            User user = _db.Users
                        .FirstOrDefault(u => u.Email == signinView.Email && u.Password == signinView.Password);

            return(user);
        }
Пример #2
0
        public async Task <IActionResult> SignIn(SigninView model)
        {
            if (ModelState.IsValid)
            {
                User user = _userService.SignIn(model);
                if (user != null)
                {
                    await Authenticate(user.Email, user.Id.ToString());

                    return(RedirectToAction("Index", "Home"));
                }
                ModelState.AddModelError("", "Wrong email and/or password");
            }
            return(View(model));
        }
Пример #3
0
 public bool Exists(SigninView signinView)
 {
     return(_db.Users.FirstOrDefault(u => u.Email == signinView.Email) != null);
 }
Пример #4
0
 public User(SigninView signinView)
 {
     Email    = signinView.Email;
     Password = signinView.Password;
 }