Example #1
0
        public IActionResult Login(ClubModel club)
        {
            iClubRetrieveContext context  = HttpContext.RequestServices.GetService(typeof(BarBoekASP.Data.MySQL.ClubMySQLContext)) as iClubRetrieveContext;
            iUserRetrieveContext ucontext = HttpContext.RequestServices.GetService(typeof(BarBoekASP.Data.MySQL.UserMySQLContext)) as iUserRetrieveContext;
            UserTest             user     = new UserTest();

            user.UEmail   = club.ClubNumber;
            user.Password = club.Postcode;
            bool check  = context.Inloggen(club);
            bool ucheck = ucontext.Inloggen(user);

            if (check)
            {
                return(View("Confirm"));
            }
            else
            {
                if (ucheck)
                {
                    int?test = HttpContext.Session.GetInt32("loggedIn");
                    HttpContext.Session.SetInt32("loggedIn", 1);

                    return(RedirectToAction("Index", "Dashboard"));
                }
                else
                {
                    ModelState.AddModelError("Postcode", "Password incorrect.");
                    return(View("Index"));
                }
            }
        }
Example #2
0
        public IActionResult Confirm(UserTest user)
        {
            iUserSaveContext     context    = HttpContext.RequestServices.GetService(typeof(BarBoekASP.Data.MySQL.UserMySQLContext)) as iUserSaveContext;
            iUserRetrieveContext retcontext = HttpContext.RequestServices.GetService(typeof(BarBoekASP.Data.MySQL.UserMySQLContext)) as iUserRetrieveContext;

            if (retcontext.CheckValidate(user) == false)
            {
                context.InsertUser(user);
                TempData["Success"] = "U heeft een account aangemaakt.";
                return(View("Confirm"));
            }
            else
            {
                ModelState.AddModelError("UEmail", "Deze email bestaat al.");
                return(View("Confirm"));
            }
        }