public ActionResult Register(Account acc) { if (acc.Email == null || acc.Wachtwoord == null) { ViewBag.Message1 = "Vul een email en wachtwoord in."; return(View()); } if (acc.Wachtwoord != acc.HerhalingWachtwoord) { ViewBag.Message1 = "Herhaling wachtwoord niet gelijk. Let op spelfouten."; return(View()); } if (!_accountRepository.ValidEmail(acc.Email)) { ViewBag.Message1 = "Gebruik een valide email adres."; return(View()); } if (!_accountRepository.ValidPassword(acc.Wachtwoord)) { ViewBag.Message2 = "Een wachtwoord moet ten minste 1 hoofdletter, 1 kleine letter, 1 cijfer hebben."; return(View()); } acc = new Account(acc.Email, PasswordManager.Hash(acc.Wachtwoord), acc.HerhalingWachtwoord, acc.Admin); if (_accountRepository.CheckBestaatAccount(acc)) { ViewBag.Message1 = "Account met deze email bestaat al."; return(View()); } _accountRepository.AddAccount(acc); return(View("Login")); }
// ------------------------------ Account ------------------------------- #region Account /// <summary> /// Creates and Adds a new account to the Database /// </summary> /// <param name="email">Email Address</param> /// <returns></returns> public Model.Account AddAccount(string email) { /* Account account = null; * * account = new Account * { * UserName = userName, * Email = email, * Password = password, * ID = 1 // HACK: This needs to be changed so it is automatically updated by the DB * }; * try * { * stubADB.accounts.Add(account); * } * catch (Exception) * { * account = null; * throw; * }*/ Model.Account account = ConvertAccount(accrepo.AddAccount(email)); return(account); }
public ActionResult Register(Account acc) { string mailregex = @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"; string passregex = @"^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}$"; bool isMailMatch = Regex.IsMatch(acc.Email, mailregex); bool isPassMatch = Regex.IsMatch(acc.Password, passregex); if (!isMailMatch) { ViewBag.Message1 = "Please enter a valid Emailaddress"; return(View()); } if (!isPassMatch) { ViewBag.Message2 = "Please enter a password with atleast 1 uppercase letter, 1 lowercase letter and 1 digit and 8 characters"; return(View()); } Account account = new Account { Email = acc.Email, Password = PasswordManager.Hash(acc.Password) }; accountRepository.AddAccount(account); return(View("Login")); }
static void AddAccount(string iban, string name, long bankId, long customerId, decimal balance) { Account account = new Account(iban, name, bankId, customerId, balance); AccountRepository accountRepository = new AccountRepository(); accountRepository.AddAccount(account); }
public MainWindowViewModel() { var id = new Guid("5f6e55b3-eff9-b16c-0097-2644033ba3f5"); var resp = new AccountRepository(); Account = resp.Get(id)?.ConvertTo <Account>(); if (Account == null) { var account = new Account(); account.ID = id; account.UserName = "******"; account.Password = "******"; //var resp = new AccountRepository(); resp.AddAccount(account.ConvertTo <Entity.Database.Account>()); Account = resp.Get(id)?.ConvertTo <Account>(); } ConfirmCommand = new DelegateCommand(() => { var a = Account.Error; }); }
public static bool RegisterAccount(Account account) { //processing return(AccountRepository.AddAccount(account)); //validating //TODO }
public IActionResult AddAccount([FromBody] Account account) { if (_accountRepo.AddAccount(account)) { return(Ok(account.Id_student)); } return(NotFound()); }
public ActionResult CreateUser(string userName, string password, string roles) { var newUser = new Account() { UserName = userName, Roles = (String.IsNullOrWhiteSpace(roles) ? new string[0] : roles.Split(',')) }; newUser.SetPassword(password); var repo = new AccountRepository(); repo.AddAccount(newUser); return(RedirectToAction("Index")); }
public void Add_User_Acccount_Repo() { var db = new AccountRepository(); var user = new AccountModel() { FirstName = "Ryan", LastName = "Kelton", Username = "******", Password = "******", PermissionLevel = (int)Permission.SITE_STANDARD, }; var result = db.AddAccount(user); Assert.AreEqual(DbError.SUCCESS, result); }
public void AddAccount(string name, string personType, string accountType, string account_ID, string agency, string balance) { if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(personType) || string.IsNullOrEmpty(accountType) || string.IsNullOrEmpty(account_ID) || string.IsNullOrEmpty(agency) || string.IsNullOrEmpty(balance)) { throw new FieldsNotFilledException("Preencha todos os campos"); } //return -1; //one of the required fields is not filled double dBalance = Convert.ToDouble(balance); //test Account account = new Account(account_id: account_ID, agency: agency, accountType: accountType, owner: new Person(name)); account.CalcSaldo(balance: dBalance); accountRepo.AddAccount(account); }
public ActionResult Register(Account account) { if (account == null) { return(View()); } if (!_accountRepository.ValidEmail(account.Email) || !_accountRepository.ValidPassword(account.Wachtwoord)) { ViewBag.Message = "Please enter a valid emailaddress and a password with atleast 1 uppercase letter, 1 lowercase letter and 1 digit and has a lenght between 4 and 16 characters"; return(View()); } account.Wachtwoord = WachtwoordManager.Hash(account.Wachtwoord); account.Admin = false; _accountRepository.AddAccount(account); return(View("Login")); }
public ActionResult CreateForAccount(IFormCollection collection) { try { var accountRepo = new AccountRepository(); var accountDTO = new Account(); accountDTO.AccountNumber = collection["AccountNumber"]; accountDTO.OutstandingBalance = Convert.ToInt32(collection["OutstandingBalance"]); accountDTO.PersonCode = Convert.ToInt32(collection["PersonCode"]); var code = accountRepo.AddAccount(accountDTO); return(RedirectToAction(nameof(Details), "Persons", new { id = code })); } catch { return(View()); } }
internal void AddAccount(Account account) { _accountRepository.AddAccount(account); }