public ActionResult patient() { if (Session["user"] != null) { if (Convert.ToString(Session["RoleID"]) == "3") { int ID = Convert.ToInt16(Session["ID"]); var data = clinic.Patient(ID); List <SelectListItem> objitem = new List <SelectListItem>(); foreach (spPatDrop_Result item in data) { objitem.Add(new SelectListItem { Text = item.UserID + "," + item.FirstName + " " + item.LastName, Value = item.UserID.ToString() }); } TempData["DropDownPat"] = objitem; return(View()); } else { var data2 = clinic.PatAppointment(3); List <SelectListItem> objitem2 = new List <SelectListItem>(); foreach (spPatientDetails_Result item in data2) { objitem2.Add(new SelectListItem { Text = item.UserID + "," + item.FirstName + " " + item.LastName, Value = item.UserID.ToString() }); } TempData["DropDownPat"] = objitem2; } } return(View()); }