Пример #1
0
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                if (_employeeRegistrationService.ValidateEmployee(model.UserName, model.Password))
                {

                    var customer = _employeeService.GetCustomerByUserName(model.UserName);
                    customer.LastLoginDateUtc = DateTime.UtcNow;
                    _employeeService.Update(customer);
                    //sign in new employee
                    _authenticationService.Login(customer, model.RememberMe);

                    return RedirectToLocal(returnUrl);
                }
            }

            // If we got this far, something failed, redisplay form
            ModelState.AddModelError("", "The user name or password provided is incorrect.");
            return View(model);
        }
Пример #2
0
        public ActionResult Login(string returnUrl)
        {
            ViewBag.ReturnUrl = returnUrl;
            var model = new LoginModel();

            return View(model);
        }