private static void DeleteGuest() { try { int deleteGuestID; Console.WriteLine("Enter GuestID to Delete:"); deleteGuestID = Convert.ToInt32(Console.ReadLine()); GuestBook deleteGuest = GuestBL.SearchGuestBL(deleteGuestID); if (deleteGuest != null) { bool guestdeleted = GuestBL.DeleteGuestBL(deleteGuestID); if (guestdeleted) { Console.WriteLine("Guest Deleted"); } else { Console.WriteLine("Guest not Deleted "); } } else { Console.WriteLine("No Guest Details Available"); } } catch (GuestException ex) { Console.WriteLine(ex.Message); } }
private static void UpdateGuest() { try { int updateGuestID; Console.WriteLine("Enter GuestID to Update Details:"); updateGuestID = Convert.ToInt32(Console.ReadLine()); GuestBook updatedGuest = GuestBL.SearchGuestBL(updateGuestID); if (updatedGuest != null) { Console.WriteLine("Update Guest Name :"); updatedGuest.GuestName = Console.ReadLine(); Console.WriteLine("Update PhoneNumber :"); updatedGuest.GuestContactNumber = Console.ReadLine(); bool guestUpdated = GuestBL.UpdateGuestBL(updatedGuest); if (guestUpdated) { Console.WriteLine("Guest Details Updated"); } else { Console.WriteLine("Guest Details not Updated "); } } else { Console.WriteLine("No Guest Details Available"); } } catch (GuestException ex) { Console.WriteLine(ex.Message); } }
private static void SearchGuestByID() { try { int searchGuestID; Console.WriteLine("Enter GuestID to Search:"); searchGuestID = Convert.ToInt32(Console.ReadLine()); GuestBook searchGuest = GuestBL.SearchGuestBL(searchGuestID); if (searchGuest != null) { Console.WriteLine("******************************************************************************"); Console.WriteLine("GuestID\t\tName\t\tPhoneNumber"); Console.WriteLine("******************************************************************************"); Console.WriteLine("{0}\t\t{1}\t\t{2}", searchGuest.GuestID, searchGuest.GuestName, searchGuest.GuestContactNumber); Console.WriteLine("******************************************************************************"); } else { Console.WriteLine("No Guest Details Available"); } } catch (GuestException ex) { Console.WriteLine(ex.Message); } }