public ActionResult Login(FormCollection fc) { var a = fc["usernameL"].ToString(); var b = fc["passL"].ToString(); var usr = db.user.Where(u => u.username == a && u.password == b).FirstOrDefault(); if (usr != null) { Session["id"] = usr.id; Session["Ad"] = usr.username; Session["yetki"] = usr.role.id; Session["search"] = usr.search == true ? "1" : "0"; usr.online = true; db.Entry(usr).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Find")); } else { ModelState.AddModelError("", "my db Kullanıcı adı veya şifre hatalı."); } return(View()); }