// GET: Account public ActionResult Login() { if (User.Identity.IsAuthenticated) { return(RedirectToAction("Browse_item", "Rent")); } LoginTag loginModel = new LoginTag(); return(View()); }
public bool VerifyUserByLoginAndPassword(LoginTag loginModel) { using (var db = new RentContext()) { var user = db.Users.FirstOrDefault(m => m.Login == loginModel.Login && m.Password == loginModel.Password); if (user != null) { return(true); } return(false); } }
public ActionResult Login(LoginTag loginModel) { if (ModelState.IsValid) { if (_accountService.VerifyUserByLoginAndPassword(loginModel)) { FormsAuthentication.SignOut(); FormsAuthentication.SetAuthCookie(loginModel.Login, true); return(RedirectToAction("Index", "Home")); } } return(View()); }
public static bool ging(LoginTag s)//注销是的标记清除 { string sql = "UPDATE LoginTag SET state=0,sign = ' ' WHERE (userid = " + s.userid + ")"; SqlCommand com = new SqlCommand(); q.OpenConnect(); com.CommandText = sql; com.Connection = q.Connect; int sd = com.ExecuteNonQuery(); q.CloseConnect(); if (sd > 0) { return(true); } else { return(false); } }
public static bool sing(LoginTag s)//登录时的标记 { string sql = " update LoginTag set sign='" + s.singe + "' where userid= " + s.userid + ""; SqlCommand com = new SqlCommand(); q.OpenConnect(); com.CommandText = sql; com.Connection = q.Connect; int sd = com.ExecuteNonQuery(); q.CloseConnect(); if (sd > 0) { return(true); } else { return(false); } }
}//同意好友申请 public LoginTag login(string id, string pwd)//登陆 { if (!db.Enter(id, pwd)) { return(null); } myEventHandler = new ChatEventHandler(MyEventHandler);//将MyEventHandler方法作为参数传递给委托 if (!chatters.ContainsKey(id) && id != "" && id != null) { this.id = id; chatters.Add(id, MyEventHandler); } LoginTag lt = new LoginTag(); lt.singe = Guid.NewGuid().ToString(); lt.userid = id; db.sing(lt); cb = OperationContext.Current.GetCallbackChannel <IClientcallback>(); //获取当前操作客户端实例的通道给IChatCallback接口的实例callback,此通道是一个定义为IChatCallback类型的泛类型,通道的类型是事先服务契约协定好的双工机制。 ChatEventArgs e = new ChatEventArgs(); //实例化事件消息类ChatEventArgs e.msgType = MessageType.UserEnter; e.name = id; return(lt); }
public bool logout(LoginTag l) { Leave(); return(db.ging(l)); }//下线
public ActionResult Login() { LoginTag loginModel = new LoginTag(); return(View(loginModel)); }