Exemplo n.º 1
0
        public ActionResult Register(RegistratieModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                try
                {
                    Bedrijf b = new Bedrijf();
                    b.Activiteit = model.Activiteit;
                    b.Bedrijfsnaam = model.Bedrijfsnaam;
                    b.Bereikbaarheid = model.Bereikbaarheid;
                    b.Straat = model.Straat;
                    b.Straatnummer = model.Straatnummer;
                    b.Telefoon = model.Telefoon;
                    b.Url = model.Url;
                    b.Woonplaats = model.Woonplaats;
                    b.Emailadres = model.Email;
                    BedrijfRepository.Add(b);
                    BedrijfRepository.SaveChanges();
                    WebSecurity.CreateUserAndAccount(model.Email, model.Password);
                    WebSecurity.Login(model.Email, model.Password);
                    return RedirectToAction("Index", "Home");
                }
                catch (MembershipCreateUserException e)
                {
                    ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
Exemplo n.º 2
0
 public void Add(Bedrijf bedrijf)
 {
     bedrijven.Add(bedrijf);
 }