public ActionResult Login(UserInfoView entityView) { if (ModelState.IsValid) { UserInfo entity = AutoEntityMap <UserInfoView, UserInfo> .EntityMap(entityView); string pwd = Kits.GetMD5(entity.UserPwd); bool b = UserInfoBLL.Where(c => c.UserName == entity.UserName && c.UserPwd == pwd).Any(); if (b) { Session[Keys.SessionKey] = entity.UserName; return(RedirectToAction("Index", "Dashboard")); } } ModelState.AddModelError("", "用户名或密码错误"); return(View()); }