private static void Delete() { Console.Clear(); Console.WriteLine("Delete menu: \n"); Console.WriteLine("1. Delete person"); Console.WriteLine("2. Delete medal"); Console.WriteLine("3. Delete reward"); Console.WriteLine("4. To main menu"); Console.Write("\nChoose menu item "); switch (Console.ReadKey().Key) { case ConsoleKey.D1: { Console.WriteLine("\n"); Console.Write("Enter person's ID: "); int personID = int.Parse(Console.ReadLine()); try { personLogic.Delete(personID); } catch (Exception ex) { Console.WriteLine($"\n{ex.Message}"); Console.WriteLine("Press any key for continue"); Console.ReadKey(); } Start(); break; } case ConsoleKey.D2: { Console.WriteLine("\n"); Console.Write("Enter medal's ID: "); int medalID = int.Parse(Console.ReadLine()); try { medalLogic.Delete(medalID); } catch (Exception ex) { Console.WriteLine($"\n{ex.Message}"); Console.WriteLine("Press any key for continue"); Console.ReadKey(); } Start(); break; } case ConsoleKey.D3: { Console.WriteLine("\n"); Console.Write("Enter person's ID: "); int personID = int.Parse(Console.ReadLine()); Console.Write("Enter medal's ID: "); int medalID = int.Parse(Console.ReadLine()); try { personLogic.DeleteReward(personID, medalID); } catch (Exception ex) { Console.WriteLine($"\n{ex.Message}"); Console.WriteLine("Press any key for continue"); Console.ReadKey(); } Start(); break; } case ConsoleKey.D4: { Start(); break; } default: return; } }
public void TestDeletingReward() { logic.DeleteReward(1, 1); }