public ActionResult PatientAppointment(string date) { string username = TempData["username"].ToString(); TempData.Keep(); if (ModelState.IsValid) { List <Appointment> patientsList = new List <Appointment>(); patientsList = AppointmentDAL.GetAll(username, date); return(View(patientsList)); } else { ModelState.AddModelError("", "Enter valid date..!!"); return(View()); } }