Пример #1
0
        private static void RemoveHotel()
        {
            Console.Clear();
            Console.WriteLine("Indlæs hotelnr");
            var hotelNo = Convert.ToInt32(Console.ReadLine());
            var hs      = new HotelServiceAsync();
            var hotel   = hs.DeleteHotelAsync(hotelNo).Result;

            Console.WriteLine(hotel != null
                ? $"Hotel-Nr: {hotel.HotelNr}, Navn: {hotel.Name}, Adresse: {hotel.Address} er blevet fjernet fra databasen."
                : $"Hotelnummer {hotelNo} findes ikke i databasen.");
        }
Пример #2
0
        private static void DeleteHotelAsync()
        {
            Console.Clear();
            Console.WriteLine("Indlæs Hotelnr der skal fjernes");
            int hotelnr               = Convert.ToInt32(Console.ReadLine());
            HotelServiceAsync hs      = new HotelServiceAsync();
            Hotel             deleted = hs.DeleteHotelAsync(hotelnr).Result;

            if (deleted != null)
            {
                Console.WriteLine("Deletion Succesful");
            }
            else
            {
                Console.WriteLine("Error in Deletion");
            }
        }