public ActionResult Register(UserAccount account)
 {
     if (ModelState.IsValid)
     {
         using (Context db = new Context())
         {
             account.Password = SecurityUtil.hashPassword(account.Password);
             account.ConfirmPassword = SecurityUtil.hashPassword(account.ConfirmPassword);
             db.UserAccounts.Add(account);
             db.SaveChanges();
         }
         ModelState.Clear();
         ViewBag.Message = account.FirstName + " " + account.LastName + "Registratie is voltooid.";
     }
     return View();
 }
 public ActionResult Login(UserAccount user)
 {
     using (Context db = new Context())
     {
         var usr = db.UserAccounts.Where(u => u.Username == user.Username).FirstOrDefault();
         if (usr != null && usr.Password == SecurityUtil.hashPassword(user.Password))
         {
             Session["UserID"] = usr.UserID.ToString();
             Session["Gebruikersnaam"] = usr.Username.ToString();
             return RedirectToAction("LoggedIn");
         }
         else
         {
             ModelState.AddModelError("", "Gebruikersnaam of wachtwoord zijn fout");
         }
     }
     return View();
 }