Ejemplo n.º 1
0
 public int Update(HastanelerEntities hastane)
 {
     cmd = new SqlCommand("update Hastaneler SET HastaneAdi=@hAd where HastaneID=@hastaneID", conn);
     cmd.Parameters.AddWithValue("@hAd", hastane.HastaneAdi);
     cmd.Parameters.AddWithValue("@hastaneID", hastane.HastaneID);
     return(ExecuteCommand());
 }
Ejemplo n.º 2
0
        public HastanelerEntities GetHastaneById(int hastaneID)
        {
            HastanelerEntities currentHastane = new HastanelerEntities();

            cmd = new SqlCommand("Select * From Hastaneler Where hastaneID = @id", conn);
            cmd.Parameters.AddWithValue("@id", hastaneID);
            conn.Open();
            SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);

            reader.Read();
            currentHastane.HastaneID  = reader.GetInt32(0);
            currentHastane.HastaneAdi = reader.GetString(1);
            reader.Close();
            return(currentHastane);
        }
Ejemplo n.º 3
0
 public int Add(HastanelerEntities hastane)
 {
     cmd = new SqlCommand("INSERT INTO Hastaneler VALUES (@hAd)", conn);
     cmd.Parameters.AddWithValue("@hAd", hastane.HastaneAdi);
     return(ExecuteCommand());
 }