public ActionResult PostDoctorAppointment(DoctorAppModel da) { CommonData model = new CommonData(); if (!ModelState.IsValid) { da.doclst = model.DoctorApp(); return(View("DoctorAppointment", da)); } int memid = Convert.ToInt32(Session["MemberId"]); using (ProjectEntities1 im = new ProjectEntities1()) { var getdata = im.Patients.FirstOrDefault(a => a.MemberId == memid); da.AppointmentStatus = "Requested"; int id = Convert.ToInt32(getdata.PatientId); im.InsertDoctorApp(id, da.DoctorId, da.Subject, da.Description, da.AppointmentDate, da.AppointmentStatus); } CommonData mcm = new CommonData(); da.doclst = mcm.DoctorApp(); ViewBag.message = "Appointment Requested !"; return(View("DoctorAppointment", da)); }