Пример #1
0
        public ActionResult Login()
        {
            var vm = new LoginPageViewModel
            {
                Username = "******",
                Password = "******"
            };

            return View(vm);
        }
Пример #2
0
        public ActionResult Login(LoginPageViewModel viewModel)
        {
            if (string.IsNullOrEmpty(viewModel.Username)
                || string.IsNullOrEmpty(viewModel.Password))
            {
                viewModel.ErrorMessage = "Please provide your username and password";
                return View(viewModel);
            }

            SimpleSessionPersister.Username = viewModel.Username;

            return RedirectToAction("Index", "Home");
        }