private void delete_button_Click(object sender, EventArgs e) { if (bus_schedules_listview.SelectedItems.Count > 0) { Bus bus = (Bus)bus_schedules_listview.SelectedItems[0].Tag; _deletedBuses.Add(bus); _busService.DeleteBus(bus); RefreshBusListView(); } }
private void add_button_Click(object sender, EventArgs e) { if (!FieldsFilledCorrectly()) { return; } if (!ValuesChanged()) { Close(); return; } _busService.DeleteBus(_bus); _busService.AddNewBus(new Bus { BusNumber = bus_number_textbox.Text, DepartingStation = departing_station_textbox.Text, DestinationStation = destination_station_textbox.Text, DepartingTime = departing_dateTimePicker.Value, ArrivalTime = arrival_dateTimePicker.Value }); _mainForm.RefreshBusListView(); Close(); }
public bool Delete(int id) { return(busService.DeleteBus(id)); }