Exemplo n.º 1
0
        public async Task <int> Login(usersModel1 u)
        {
            int a = 0;
            List <usersModel1> list  = new List <usersModel1>();
            List <users>       list2 = await Task.Run(() => { return(tescDbContext.u.ToList()); });

            foreach (users item in list2)
            {
                if (u.user_name == item.user_name && u.user_password == item.user_password)
                {
                    a = 1;
                }
            }

            return(a);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> login(usersModel1 um)
        {
            int reslut = await iub.Login(um);

            if (ModelState.IsValid)
            {
                if (reslut > 0)
                {
                    HttpContext.Session.SetString("Uname", um.user_name);

                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(um));
                }
            }
            else
            {
                return(View(um));
            }
        }
Exemplo n.º 3
0
 //登录
 public Task <int> Login(usersModel1 u)
 {
     return(iud.Login(u));
 }