// // GET: /Gebruiker/ public ActionResult Index() { ViewBag.klanten = ""; var dataContext = new GebruikerDataContext(); var gebruikers = from m in dataContext.Gebruikers select m; if (gebruikers.Any()) ViewBag.gebruikers = gebruikers.ToList(); return View(); }
// // GET: /Ticket/ public ActionResult Toon(int id) { var dataContext = new TicketDataContext(); Ticket ticket = (from m in dataContext.Tickets where m.id.Equals(id) select m).Single(); ViewBag.ticket = ticket; var dataContextGebruiker = new GebruikerDataContext(); Gebruiker gebruiker = (from m in dataContextGebruiker.Gebruikers where m.emailadres.Equals(ticket.gebruikerid) select m).Single(); ViewBag.gebruiker = gebruiker; var dataContextKlant = new KlantDataContext(); Klant klant = (from m in dataContextKlant.Klants where m.id.Equals(ticket.klantid) select m).Single(); ViewBag.klant = klant; // klant.id = 2; // ViewBag.Gearlink = "/Klant/Wijzig?id=" + klant.id; return View(ticket); //ViewBag.id = id; return View(); }
public ActionResult Login(LoginModel model, string returnUrl) { if (ModelState.IsValid) { var dataContext = new GebruikerDataContext(); var gebruikers = (from m in dataContext.Gebruikers where m.token.Equals(model.Password) select m); if (gebruikers.Any()) // klant.id = 2; // if (Membership.ValidateUser(model.UserName, model.Password)) { Gebruiker gebruiker = gebruikers.First(); model.UserName = gebruiker.emailadres; model.voornaam = gebruiker.voornaam; model.achternaam = gebruiker.achternaam; Membership.ValidateUser(gebruiker.emailadres, gebruiker.wachtwoord); FormsAuthentication.SetAuthCookie(model.UserName, true); if (Url.IsLocalUrl(returnUrl)) { return Redirect(returnUrl); } else { return RedirectToAction("Index", "Home"); } } else { ModelState.AddModelError("", "The user name or password provided is incorrect."); } } // If we got this far, something failed, redisplay form return View(model); }