public ActionResult Create(string gebruikersnaam, string wachtwoord, string functie) { if (Session["gebruikersnaam"] != null) { model.AllFunctiesFromGebruikers = GebruikerRepo.GetAllFunctions(); if (String.IsNullOrEmpty(gebruikersnaam) || String.IsNullOrEmpty(wachtwoord) || String.IsNullOrEmpty(functie)) { ViewBag.error = "Je hebt niks ingevuld. Vul de velden in en probeer het opnieuw."; return(View(model)); } bool adding = GebruikerRepo.AddUser(gebruikersnaam, wachtwoord, functie); if (adding == true) { ViewBag.error = null; return(RedirectToAction("Index", "Remise")); } else { ViewBag.error = "Er is iets fout gegaan. Probeer het opnieuw."; return(View(model)); // De view die een foutmelding geeft en het opnieuw laat proberen. } } else { return(RedirectToAction("Index", "Home")); } }