예제 #1
0
 public ActionResult Index(AdminModel adminLogin)
 {
     if (ModelState.IsValid)
     {
         var dao    = new AdminLoginDAO();
         var result = dao.LoginAdmin(adminLogin.UserName, EncryptMd5.MD5Hash(adminLogin.Password));
         if (result == 1)
         {
             Session.Add(ConstSession.SessionUser, adminLogin);
             return(RedirectToAction("Index", "HomeAdmin"));
         }
         else
         {
             ModelState.AddModelError("", "Tên tài khoản hoặc mật khẩu không chính xác");
         }
     }
     return(View());
 }
예제 #2
0
        private void bunifuThinButton28_Click(object sender, EventArgs e)
        {
            string un   = bunifuMaterialTextbox13.Text;
            string pass = bunifuMaterialTextbox12.Text;


            MyDbConnect m1 = new MyDbConnect();

            m1.OpenConnection();
            AdminLoginDAO a1 = new AdminLoginDAO();

            if (un.Equals("Admin") && pass.Equals("Admin123"))
            {
                this.Hide();
                new Admin().Show();
            }

            else if (a1.AdminLogin(un, pass))
            {
                this.Hide();
                new Trainer().Show();
            }
            m1.CloseConnection();
        }