public ActionResult Login(User model) { BaseRepository <User> _repo = new BaseRepository <User>(); var repo = _repo.Query <User>().Where(x => x.Email == model.Email && x.Password == model.Password).ToList(); if (repo.Count > 0) { User _temp = new User(); foreach (var item in repo) { _temp.UserName = item.UserName; _temp.Email = item.Email; _temp.Id = item.Id; //_temp.LastName = item.LastName; //_temp.Dis = item.Dis; } SessionSet <User> .Set(_temp, "login"); return(RedirectToAction("Index", "Home")); } else { ModelState.AddModelError("", "Hatalı Giriş Yaptınız"); return(View()); } }
public ActionResult Login(User user) { var email = user.Email; var pass = user.Password; var result = _br.Query <User>().Where(k => (k.Email.Equals(email)) && (k.Password.Equals(pass))).Any(); if (result) { var myuser = _br.Query <User>().Where(k => (k.Email.Equals(email)) && (k.Password.Equals(pass))).FirstOrDefault(); User _temp = new User() { ID = myuser.ID, Name = myuser.Name, Email = myuser.Email, Password = myuser.Password, CreatedDate = myuser.CreatedDate }; SessionSet <User> .Set(_temp, "Login"); return(RedirectToAction("Home", "Home")); } else { string msg = "<script language=\"javascript\">"; msg += "alert('" + "The username and password you entered did not match our records. Please double-check and try again." + "');"; msg += "</script>"; Response.Write(msg); return(RedirectToAction("Start", "Home")); } }
public ActionResult Login(User user) { var userName = user.UserName; var pass = user.Password; bool result = _br.Query <User>().Where(k => (k.UserName.Equals(userName)) && (k.Password.Equals(pass))).Any(); if (result) { IQueryable <User> users = _br.Query <User>().Where(k => (k.UserName.Equals(userName)) && (k.Password.Equals(pass))); var myUser = users.FirstOrDefault(); User _temp = new User(); _temp.ID = myUser.ID; _temp.NameLastname = myUser.NameLastname; _temp.UserName = myUser.UserName; _temp.Email = myUser.Email; _temp.Password = myUser.Password; SessionSet <User> .Set(_temp, "Login"); return(RedirectToAction("Home", "Home")); } else { ModelState.AddModelError("", "The username and password you entered did not match our records. Please double-check and try again."); return(RedirectToAction("Starting", "Home")); } }
public ActionResult TweetID(int id)//click tweet { Comment com = new Comment(); com.tweetID = id; SessionSet <Comment> .Set(com, "get"); return(View()); }
public ActionResult TweetId(int id) { Comment com = new Comment(); com.Id = id; SessionSet <Comment> .Set(com, "get"); return(View()); }
public bool Login(User user) { using (BaseRepository <User> _repo = new BaseRepository <User>()) { if (user != null) { var result = _repo.Query <User>().Where(x => (x.Username == user.Username) && (x.Password == user.Password)).Any(); var getUser = _repo.Query <User>().Where(x => (x.Username == user.Username) && (x.Password == user.Password)).ToList(); if (result == true) { User _temp = new User(); foreach (var item in getUser) { _temp.Username = item.Username; _temp.Password = item.Password; _temp.Id = item.Id; _temp.Name = item.Name; _temp.yetki = item.yetki; } SessionSet <User> .Set(_temp, "User"); return(true); } else { return(false); } } else { return(false); } } }