public ActionResult Login(User u) { if (ModelState.IsValid) { DataAbstractionLayer dal = new DataAbstractionLayer(); int authenticatedUserId = dal.Authenticate(u); if (authenticatedUserId != -1) { Session["LoggedUserID"] = authenticatedUserId; return(RedirectToAction("Index", "Main")); } } return(View("LoginFailedView")); }