public ActionResult Index(tbluser usr) { myshopDBEntities obj = new myshopDBEntities(); var a = obj.tblusers.Where(l => l.uname.Equals(usr.uname) && l.upass.Equals(usr.upass)).ToList(); if (a.Count > 0) { Session["uname"] = usr.uname.ToString(); return(RedirectToAction("Dashboard")); } else { ViewBag.msg = "Invalid Username or Password!"; } return(View()); }