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; }
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(); }
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); }
public LoginServices(UserRepository repository) { this.repository = repository; }