public ActionResult LogIn(string username, string password) { int id; int numOfActions; string fullName; Status status = loginBL.LogIn(username, password, out id, out fullName, out numOfActions); if (status.Equals(Status.Authorized)) { Session["id"] = id; Session["fullName"] = fullName; Session["numOfActions"] = numOfActions; return(Redirect("HomePage")); } else { switch (status) { case Status.Unauthorized: ViewBag.ErrorMessage = "Invalid Data"; break; case Status.AuthorizedButReachMaximumActionsPerDay: ViewBag.ErrorMessage = "Maximum allowed actions per day has been reached"; break; } return(View("LogIn")); } }
private void btnLogin_Click(object sender, EventArgs e) { Lvl = bl.LogIn(txtUsername.Text, txtPassword.Text); if (Lvl > 0) { MessageBox.Show(bl.LogInMessage); DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show(bl.LogInMessage); DialogResult = DialogResult.Cancel; this.Close(); } }