public ActionResult payment1(tblPayment p) { if (ModelState.IsValid) //if validations are satisfied then it goes into model { tblBooking z = (tblBooking)Session["var"]; //here we are retrieving tblbooking object values that are stored in session variable bool s = Dbclass.getpayment(p); if (s == true) //if payment is done successfully then it goes to insertion of booking { string x = Dbclass.getbooking(z); //for inserting into booking ViewBag.g = x; } return(View()); } else { ViewBag.msg = Session["bill"].ToString(); slist = Dbclass.getstate(); ViewBag.bankid = slist; return(View("payment")); //it will show where the validation is missing } }