Example #1
0
        static void Main(string[] args)
        {
            ChannelFactory <IHotelBookingService> serviceFactory =
                new ChannelFactory <IHotelBookingService>
                    (new BasicHttpBinding(),
                    "http://localhost:8733/HotelBooking/HotelBookingHttp");

            IHotelBookingService proxy = serviceFactory.CreateChannel();

            Reservation reservation = new Reservation();

            reservation.HotelName = "HoteYA";

            reservation.GuestName = "John";

            reservation.NumberOfDays = 3;

            reservation.CheckinDate = DateTime.Now;

            BookingResponse response = proxy.BookHotel(reservation);

            Console.WriteLine
                ("Booking response: {0}, booking reference: {1}",
                response.IsApproved ? "Approved" : "Declined",
                response.BookingReference);

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            IHotelBookingService proxy = null; // TODO channel Factory

            Reservation reservation = new Reservation
            {
                HotelName    = "HotelA",
                GuestName    = "John",
                NumberOfDays = 3,
                CheckinDate  = DateTime.Now
            };

            BookingResponse response = proxy.BookHotel(reservation);

            Console.WriteLine
                ("Booking response: {0}, booking reference: {1}",
                response.IsApproved ? "Approved" : "Declined",
                response.BookingReference);

            Console.ReadLine();
        }