private void Delete() { Repository.EventRepository eventsRepository = new Repository.EventRepository("events.txt"); Console.Clear(); Console.WriteLine("Delete Event:"); Console.Write("Event Id: "); int eventId = Convert.ToInt32(Console.ReadLine()); Event events = eventsRepository.GetById(eventId); if (events == null) { Console.WriteLine("Event not found!"); } else { eventsRepository.Delete(events); Console.WriteLine("Event deleted successfully."); } Console.ReadKey(true); }
public void DeleteEvent(int id) { Repository.EventRepository repository = new Repository.EventRepository(); repository.Delete(id); }