public ActionResult Appointment(string PatDetails, string DocDetails, DateTime AppDate) { int res; try { if (Session["user"] != null) { res = clinic.GetAppointment(Convert.ToInt16(PatDetails), Convert.ToInt16(DocDetails), AppDate); if (res > 0) { TempData["data"] = "success"; return(RedirectToAction("Appointment")); } else { TempData["data"] = "error"; ViewBag.Error = "Something Went wrong....."; return(RedirectToAction("Appointment")); } } } catch (Exception ex) { TempData["data"] = "exception"; return(RedirectToAction("Appointment")); } return(View("Appointment")); }