public ActionResult Gegevens(int id) { if (!AuthRepository.CheckIfUserCanAcces(GebruikerType.All, (Gebruiker)Session["LoggedInUser"])) { return(View("~/Views/Error/AuthError.cshtml")); } try { GebruikerSqlContext sql = new GebruikerSqlContext(); GebruikerRepository repo = new GebruikerRepository(sql); VaardigheidSqlContext vsql = new VaardigheidSqlContext(); VaardigheidRepository vrepo = new VaardigheidRepository(vsql); ViewData["vaardigheden"] = vrepo.GetAll(); Gebruiker gebruiker = (from gebruikers in repo.GetUserWithType() where gebruikers.Id == id select gebruikers).First(); ViewData["gebruiker"] = gebruiker; return(View("GegevensWijzigen")); } catch (Exception e) { return(RedirectToAction("Index", "Error")); } }
// GET: Beheerder public ActionResult Index() { if (!AuthRepository.CheckIfUserCanAcces(GebruikerType.Beheerder, (Gebruiker)Session["LoggedInUser"])) { return(View("~/Views/Error/AuthError.cshtml")); } try { BeheerderViewModel model = new BeheerderViewModel(); HulpvraagSqlContext hsc = new HulpvraagSqlContext(); HulpvraagRepository hr = new HulpvraagRepository(hsc); GebruikerSqlContext gsc = new GebruikerSqlContext(); GebruikerRepository gr = new GebruikerRepository(gsc); model.LstGebruiker = gr.GetUserWithType(); model.LstHulpvraag = hr.GetAll(); return(View(model)); } catch (Exception e) { return(RedirectToAction("Index", "Error")); } }
public void RetrieveWithType() { GebruikerSqlContext gsc = new GebruikerSqlContext(); GebruikerRepository gr = new GebruikerRepository(gsc); List <Gebruiker> list = gr.GetUserWithType(); Assert.IsTrue(list.Count > 5); }