public PoliklinikEntities PoliklinikIDyeGore(int PoliklinikID) { PoliklinikEntities currentUser = new PoliklinikEntities(); cmd = new SqlCommand("Select * From Poliklinikler Where PoliklinilID = @id", conn); cmd.Parameters.AddWithValue("@id", PoliklinikID); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); reader.Read(); currentUser.PoliklinikID = reader.GetInt32(0); currentUser.PoliklinikAdi = reader.GetString(1); currentUser.HastaneID = reader.GetInt32(2); reader.Close(); return(currentUser); }
public List <PoliklinikEntities> TumPoliklinikleriGetir() { List <PoliklinikEntities> Poliklist = new List <PoliklinikEntities>(); cmd = new SqlCommand("Select * From Poliklinikler", conn); PoliklinikEntities currentUser = null; conn.Open(); SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (reader.Read()) { currentUser = new PoliklinikEntities() { PoliklinikID = reader.GetInt32(0), PoliklinikAdi = reader.GetString(1), HastaneID = reader.GetInt32(2) }; Poliklist.Add(currentUser); } reader.Close(); return(Poliklist); }