예제 #1
0
        public async Task <IActionResult> Login(string email, string password)
        {
            User_AdminController _userManager = new User_AdminController(_context);

            if (!ModelState.IsValid)
            {
                return(View());
            }
            try
            {
                //authenticate
                var userdata = new User_Admin()
                {
                    email_address = email,
                    user_password = password
                };
                //var result = new User_AdminController(_context).SignIn(HttpContext, userdata);
                //RedirectToAction("../{User_AdminController}/SignIn", new { httpContext = this.HttpContext, user= userdata });
                await _userManager.SignIn(this.HttpContext, userdata);

                if (!this.HttpContext.User.Identity.IsAuthenticated)
                {
                }
                return(RedirectToAction("Index", "Order_Header", null));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("summary", ex.Message);
                return(View());
            }
        }
예제 #2
0
        public ActionResult Logout()
        {
            User_AdminController _userManager = new User_AdminController(_context);

            _userManager.SignOut(this.HttpContext);
            return(RedirectToAction("Login", "Home", null));
        }