public JsonResult Login(string username, string psd) { UserInfoN userInfoN = _userInfoService.Login(username, psd); if (userInfoN == null) { return(JsonResult(false, null, "登录失败")); } return(JsonResult(true, null, "登陆成功")); }
public ActionResult Register(string userName, string passWord) { UserInfoN user = _userInfoService.Register(userName, passWord); if (user == null) { return(RedirectToAction("Register", new { })); } return(RedirectToAction("Login")); }
public UserInfoN Login(string userName, string passWord) { UserInfoN userInfoN = _userInforepository.Table .Where(p => p.UserName == userName && p.PassWord == passWord) .FirstOrDefault(); /*IList<UserInfoN> userInfoN = _userInforepository.Table * .Where(p => p.UserName == userName && p.PassWord == passWord) * .ToList();*/ return(userInfoN); }
//注册方法 public UserInfoN Register(string userName, string passWord) { UserInfoN userInfo = null; if (!String.IsNullOrEmpty(userName) && !String.IsNullOrEmpty(passWord)) { userInfo = new UserInfoN { UserName = userName, PassWord = passWord }; _userInforepository.Create(userInfo); } return(userInfo); }