コード例 #1
0
        public bool Login(String email, String pass)
        {
            var exists = new UserRepository().ExistsUser(CreateUserInstance(email, pass));
            if (!exists)
                throw new UserBusinessException("Usuário não cadastrado.");

            return exists;
        }
コード例 #2
0
 public UserBusiness(DatabaseFactory df = null, UnitOfWork uow = null)
 {
     DatabaseFactory dfactory = df == null ? new DatabaseFactory() : df;
     _unitOfWork = uow == null ? new UnitOfWork(dfactory) : uow;
     _userRepository = new UserRepository(dfactory);
   
     this._formsAuthenticationFactory = new FormsAuthenticationFactory();
 }
コード例 #3
0
ファイル: SignInController.cs プロジェクト: nhanthieugia/BSG
        public ActionResult DoLogin(AdminLoginViewModel model)
        {
            if (ModelState.IsValid)
            {
                var result = new UserRepository().AdminLogin(model.Email, model.Password);
                if (result != null)
                {
                    SessionManager.AdminIsLoggedIn = true;
                    SessionManager.Admin = result;
                    return RedirectToAction("index", "dashboard", new {area = "manager"});
                }

                ModelState.AddModelError("","Email hoặc mật khẩu không chính xác. Vui lòng thử lại");

            }
            return View("Index", model);
        }
コード例 #4
0
 public LoginServices(UserRepository repository)
 {
     this.repository = repository;
 }