Пример #1
0
        public static void DeleteAll()
        {
            SqlConnection conn = DB.Connection();

            conn.Open();

            SqlCommand cmd = new SqlCommand("DELETE FROM venues;", conn);

            DB.CloseNonQuery(cmd, conn);
        }
Пример #2
0
        public void Delete()
        {
            SqlConnection conn = DB.Connection();

            conn.Open();

            SqlCommand cmd = new SqlCommand("DELETE FROM venues WHERE id = @VenueId; DELETE FROM venues_bands WHERE venue_id = @VenueId;", conn);

            cmd.Parameters.Add(new SqlParameter("@VenueId", this.GetId()));

            DB.CloseNonQuery(cmd, conn);
        }
Пример #3
0
        public void AddVenue(Venue newVenue)
        {
            SqlConnection conn = DB.Connection();

            conn.Open();

            SqlCommand cmd = new SqlCommand("INSERT INTO venues_bands (band_id, venue_id) VALUES (@BandId, @VenueId);", conn);

            cmd.Parameters.Add(new SqlParameter("@BandId", this.GetId()));
            cmd.Parameters.Add(new SqlParameter("@VenueId", newVenue.GetId()));

            DB.CloseNonQuery(cmd, conn);
        }