public IActionResult DoLogin() { if (!Request.Form["login_id"].Equals("")) { string query = "SELECT USER_ID" + ", NAME" + ", AUTHOR" + ", BIRTHDAY" + ", PHONE" + ", EMAIL" + " FROM OP_USER" + " WHERE USER_ID = @login_id:CHAR" + " AND PASSWORD = @login_pass:VARCHAR"; // 쿼리 결과가 딕셔너리로 반환됨 // SelectOne은 단 한건의 결과만 반환됨, 나머지는 날라감 Dictionary <string, string> result = _commonDao.SelectOne(query, Request.Form); if (!result["USER_ID"].Equals("")) { UserModel userInfo = new UserModel(); userInfo.user_id = result["USER_ID"]; userInfo.name = result["NAME"]; userInfo.author = result["AUTHOR"]; userInfo.birthday = result["BIRTHDAY"]; userInfo.phone = result["PHONE"]; userInfo.email = result["EMAIL"]; SessionExtensionTool.SetObject(HttpContext.Session, "userInfo", userInfo); return(Redirect("/Main/Main")); } } return(RedirectToAction("Login", new { alertLogin = 1 })); }
public IActionResult DoLogout() { SessionExtensionTool.SetObject(HttpContext.Session, "userInfo", null); return(Redirect("/")); }