コード例 #1
0
        public IActionResult Login(Kunder K)
        {
            var Validate = new LoginValidation(_Connection, _httpContextAccessor);
            var Kunder   = _Connection.GetAllKunder();

            if (Validate.ValidateLogin(K, Kunder) && Validate.ValidatePassword(K, Kunder))
            {
                Validate.CheckLogin(K);
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                if (!Validate.ValidateLogin(K, Kunder))
                {
                    ModelState.AddModelError("Kund.Anvandarnamn", "Fel Användarnamn");
                }

                if (!Validate.ValidatePassword(K, Kunder))
                {
                    ModelState.AddModelError("Kund.Losenord", "Fel Lösenord");
                }

                return(View(K));
            }
        }