public void AddVenue(Venue newVenue) { SqlConnection conn = DB.Connection(); conn.Open(); SqlCommand cmd = new SqlCommand("INSERT INTO venues_bands (venues_id, bands_id) VALUES (@VenueId, @BandsId);", conn); SqlParameter bandIdParameter = new SqlParameter(); bandIdParameter.ParameterName = "@BandsId"; bandIdParameter.Value = this.GetId(); cmd.Parameters.Add(bandIdParameter); SqlParameter venueIdParameter = new SqlParameter(); venueIdParameter.ParameterName = "@VenueId"; venueIdParameter.Value = newVenue.GetId(); cmd.Parameters.Add(venueIdParameter); cmd.ExecuteNonQuery(); if (conn != null) { conn.Close(); } }
public void TEST_FindReturnsVenue() { Venue tempVenue = new Venue("Grand Palace"); tempVenue.Save(); Assert.Equal(tempVenue, Venue.Find(tempVenue.GetId())); }
public void Test_CheckUpdateVenueInfo_True() { Venue testVenue = new Venue("Venue", "Portland"); testVenue.Save(); int id = testVenue.GetId(); Venue.Update("Venue", "Seattle", id); Venue updated = Venue.Find(id); Assert.Equal(updated.GetCity(), "Seattle"); }
public void Test_CheckDeleteVenue_False() { Venue testVenue = new Venue("Venue", "Portland"); testVenue.Save(); List <Venue> result = Venue.GetAll(); Venue.RemoveAVenue(testVenue.GetId()); List <Venue> deleted = Venue.GetAll(); bool isEqual = (result == deleted); Assert.Equal(false, isEqual); }
public override bool Equals(System.Object otherVenue) { if (!(otherVenue is Venue)) { return false; } else { Venue newVenue = (Venue) otherVenue; bool idEquality = (this.GetId() == newVenue.GetId()); bool nameEquality = (this.GetName() == newVenue.GetName()); return (idEquality && nameEquality); } }