public ActionResult ATM_A(A_ATM user) { BankEntities usersEntities = new BankEntities(); int? userId = usersEntities.VALIDATE_A_ADMIN(user.a_admin_name.ToString(), user.a_admin_pin.ToString()).FirstOrDefault(); string message = string.Empty; switch (userId.Value) { case -1: message = "Username or password is incorrect"; break; case 0: FormsAuthentication.SetAuthCookie(user.a_admin_name, user.RememberMe); return(RedirectToAction("Index", "ATMs", user)); } ViewBag.Message = message; return(View(user)); }