public ActionResult Login([Bind(Include = "mail,parola")] User user) { System.Diagnostics.Debug.WriteLine("Debugging Login"); if (ModelState.IsValid) { using (yenimvcEntities db = new yenimvcEntities()) { User obj = db.User.Where(a => a.mail.Equals(user.mail) && a.parola.Equals(user.parola)).FirstOrDefault(); if (obj != null) { Session["isAdmin"] = obj.isAdmin; Session["UserID"] = obj.userId.ToString(); Session["userId"] = obj.userId; Session["UserName"] = obj.mail.ToString(); if (obj.isAdmin == 0) { Session["Name"] = obj.isim.ToString() + " " + obj.soyisim.ToString(); } return(RedirectToAction("Index")); } return(View("LoginFail")); } } else { return(HttpNotFound()); } }