public IActionResult Registration(AccountViewModel accountView) { AccountViewModelConverter avc = new AccountViewModelConverter(); if (ModelState.IsValid) { Account account = avc.ViewModeltoAccount(accountView); if (accountRepo.CheckIfEmailExist(account) == true) { ModelState.AddModelError("Email", "Dit e-mailadres bestaat al"); return(View("Registration")); } else { accountRepo.Registration(account); CookieOptions option = new CookieOptions { Expires = DateTime.Now.AddMinutes(30) }; Response.Cookies.Append("nsstoelvinder", account.Email, option); return(RedirectToAction("Travelplan", "Travelplan")); } } return(View(accountView)); }
public void TestValidCheckIfEmailExist() { Account account = new Account("Emailadres"); bool testreset = accountRepro.CheckIfEmailExist(account); Assert.IsTrue(testreset); }