protected void Button1_Click(object sender, EventArgs e) { string userName = TextBox1.Text; string password = Password1.Value; bool isValid = userBusinessLogic.LoginVerification(userName, password); if (isValid) { User user = userBusinessLogic.GetUserByUserName(userName); Session["userId"] = user.UserID; Session["userType"] = user.UserType; Label3.Text = "Success User"; if (Session["Url"] == null) { Response.Redirect("~/Main.aspx"); } else { //Response.Redirect("~/ShoppingCartPage.aspx"); Response.Redirect("~/ShoppingCartPage.aspx"); Session["Url"] = null; } } else { Label3.Text = "Invalid User"; } }
public IActionResult GetByUserName(string userName) { try { var userInfo = _userBll.GetUserByUserName(userName); if (userInfo == null) { return(NotFound()); } else { return(Ok(userInfo)); } } catch (Exception) { return(StatusCode(500)); } }