private static void GetAllGuest() { Console.Clear(); GuestService gs = new GuestService(); List <Guest> guests = gs.GetAllGuests(); foreach (Guest guest in guests) { Console.WriteLine($"GuestNr {guest.GuestNr} Guest Navn {guest.Name} Guest Adress {guest.Address}"); } }
/// <summary> /// 根据客房ID删除客房信息 /// </summary> /// <param name="roomId">客房ID</param> public static bool DeleteRoomByRoomId(int roomId) { IList <Guest> list = GuestService.GetAllGuests(); //linq查询 var objroom = from p in list where p.RoomId == roomId select p; if (objroom != null) { return(false); } else { RoomService.DeleteRoomByRoomId(roomId); return(true); } }
private static void ShowGuests() { Console.Clear(); var gs = new GuestService(); var guests = gs.GetAllGuests(); if (guests != null) { foreach (var guest in guests) { Console.WriteLine($"Gæstnr: {guest.GuestNo}, navn: {guest.Name}, adresse: {guest.Address}"); } } else { Console.WriteLine("Ingen gæster i databasen."); } }
/// <summary> /// 获得客人信息列表 /// </summary> /// <returns></returns> public static IList <Guest> GetAllGuests() { return(GuestService.GetAllGuests()); }