/// <summary> /// removes an airplane by the model /// and saves the changes to the db /// </summary> /// <param name="airplane"></param> public void RemoveAirplane(Airplane airplane) { using (var context = new AirplanesEntities()) { context.Entry(airplane).State = System.Data.Entity.EntityState.Deleted; context.Airplanes.Remove(airplane); context.SaveChanges(); } }
/// <summary> /// Removes a country by name /// </summary> /// <param name="name"></param> public void RemoveCountry(Country country) { using (var context = new AirplanesEntities()) { context.Entry(country).State = System.Data.Entity.EntityState.Deleted; context.Countrys.Remove(country); context.SaveChanges(); } }