public ActionResult PatientList(Int16 SeletedSupporter, Int16 SeletedSeyed) { PatientListModel lmd = new PatientListModel(); DataSet ds = new DataSet(); Connection.Connection con = new Connection.Connection(); ds = con.PatientData(SeletedSupporter, SeletedSeyed); lmd.Countries = con.GetListOfCountries(); lmd.SeletedSupporter = SeletedSupporter; lmd.SeletedSeyed = SeletedSeyed; foreach (DataRow dr in ds.Tables[0].Rows) { PatientModel Tmp = new PatientModel(); Tmp.Pt_Ct_Code = Convert.ToInt16(dr["Pt_Ct_Code"]); Tmp.SelectedState = con.StateData(Tmp.Pt_Ct_Code); Tmp.SelectedCountry = con.CountryData(Tmp.SelectedState); lmd.Patients.Add(new PatientModel { Pt_Id = Convert.ToInt32(dr["Pt_Id"]), //Pt_Name = dr["Pt_Name"].ToString(), //Pt_LName = dr["Pt_LName"].ToString(), Pt_Ct_Code = Tmp.Pt_Ct_Code, Pt_Seyyed = Convert.ToInt16(dr["Pt_Seyyed"]), Pt_Supporter = Convert.ToInt16(dr["Pt_Supporter"]), Pt_BirthDay = Convert.ToDateTime(dr["Pt_BirthDay"]), Pt_Sickness = dr["Pt_Sickness"].ToString(), Pt_Sex = Convert.ToInt16(dr["Pt_Sex"]), Pt_Tel = dr["Pt_Tel"].ToString(), Pt_Address = dr["Pt_Address"].ToString(), SelectedState = con.StateData(Tmp.Pt_Ct_Code), SelectedCountry = con.CountryData(Tmp.SelectedState), States = con.GetListOfStates(Tmp.SelectedCountry), Cities = con.GetListOfCities(Tmp.SelectedState), Pt_Photo_Path = dr["Pt_Photo_Path"].ToString(), Pt_CompleteName = dr["Pt_Name"].ToString() + ' ' + dr["Pt_LName"].ToString() }); } return(View(lmd)); }