private static void CheckIfExistUser(UserModel model, SmartCRMEntitiesModel db, CheckResult result) { UserRepository repository = new UserRepository(); var user = repository.GetUserByModel(db, model); if (user == null) { result.Details.Add( new CheckResultDetail(CheckResultDetail.ErrorType.Error, "NoUser", "The username or password is incorect!")); } }
public CheckResult Login() { using (var db = DbManager.CreateInstance()) { LoginValidator validator = new LoginValidator(); var result = validator.ValidateLogin(this.CurrentLogin, db); if (result.Success) { UserRepository rep = new UserRepository(); var userModel = rep.GetUserByModel(db, this.CurrentLogin); Global.CurrentUser = userModel; } return result; } }