RoomKey - API .Net C# Sample Client

The code below ilustrates how to communicate with the API.
Create a command line project and replace the code inside the Programm Class in Program.cs with the code below
        static void Main(string[] args)
        {
            GetAsync().Wait();
            PostRatesToHotelController();
        }
        
        static async Task GetAsync()
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("https://roomkeyapi.azurewebsites.net");
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage response = await client.GetAsync("hotels/Hotel_1-1/reservations/guestprofile?Key=ApiKey_1&fromDate=2014-09-09&toDate=2014-09-10");
                if (response.IsSuccessStatusCode)
                {
                    List<ReservationGuestProfile>guestProfiles = await response.Content.ReadAsAsync<List<reservationguestprofile>>(); 
                    foreach (var profile in guestprofiles)
                    {
                        console.writeline("{0}\t${1}\t{2}", profile.firstname, profile.lastname, profile.reservationdate);
                    }
                }
            }
        }
        private static httpresponsemessage postratestohotelcontroller()
        {
            using (var client = new HttpClient())
            {
                var testurl = "https://roomkeyapi.azurewebsites.net/hotels/Hotel_1-1/rates?key=ApiKey_1" ;
                var result = client.PostAsJsonAsync<RateRecommendation>(testURL, 
                    new RateRecommendation 
                        {
                            DateFrom = DateTime.Today,
                            DateTo = DateTime.Today.AddDays(1),
                            RateId = "1",
                            InventoryId = "1",
                            SingleRate = 1.11m,
                            DoubleRate = 2.22m,
                            TripleRate = 3.33m,
                            QuadrupleRate = 4.44m,
                            ExtraRate = 5.55m,
                            ExtraYouthRate = 6.66m
                        }
                    ).Result;
            }
            return result;
        }

Then add these two models to the project:

    public class ReservationGuestProfile
    {
        private decimal _RoomRate;
        private decimal _RoomRevenue;
        private decimal _OtherRevenue;
        private decimal _TotalRevenue;
        private decimal _DepositPaid;
        private decimal _Taxes;
        private decimal _ResortFee;
    
        public int FolioNumber { get; set; }
        public string Title { get; set; }
        public string FirstName { get; set; }
        public string MiddleInitial { get; set; }
        public string LastName { get; set; }
        public string AddressLine1 { get; set; }
        public string AddressLine2 { get; set; }
        public string City { get; set; }
        public string StateCode { get; set; }
        public string CountryCode { get; set; }
        public string ZipCode { get; set; }
        public bool MailToFlag { get; set; }
        public string EmailAddress { get; set; }
        public string TelephoneNumber { get; set; }
        public string VIPCode { get; set; }
        public string CompanyName { get; set; }
        public string CompanyEmailAddress { get; set; }
        public string CompanyFaxNumber { get; set; }
        public string PropertyCode { get; set; }
        public string RoomNumber { get; set; }
        public string RoomTypeCode { get; set; }
        public string ArrivalDate { get; set; }
        public string DepartureDate { get; set; }
        public string TimeofCheckOut { get; set; }
        public int NumberOfNights { get; set; }
        public int NumberOfAdults { get; set; }
        public int NumberOfChildren { get; set; }
        public decimal RoomRate { get { return decimal.Round(_RoomRate, 2); } set { _RoomRate = value; } }
        public string GuestType { get; set; }
        public bool IsGuestTaxExempt { get; set; }
        public string PaymentType { get; set; }
        public decimal RoomRevenue { get { return decimal.Round(_RoomRevenue, 2); } set { _RoomRevenue = value; } }
        public decimal OtherRevenue { get { return decimal.Round(_OtherRevenue, 2); } set { _OtherRevenue = value; } }
        public decimal TotalRevenue { get { return decimal.Round(_TotalRevenue, 2); } set { _TotalRevenue = value; } }
        public string ReservationDate { get; set; }
        public string TravelAgent { get; set; }
        public string TravelAgentFaxNumber { get; set; }
        public string TravelAgentEmailAddress { get; set; }
        public string Contact { get; set; }
        public string ContactFaxNumber { get; set; }
        public string ContactEmailAddress { get; set; }
        public string BookingNumber { get; set; }
        public string PackageCode { get; set; }
        public string SourceOfBusiness { get; set; }
        public string MarketingCode { get; set; }
        public string PromoCode { get; set; }
        public string Status { get; set; }
        public string RecordType { get; set; }
        public decimal DepositPaid { get { return decimal.Round(_DepositPaid, 2); } set { _DepositPaid = value; } }
        public decimal Taxes { get { return decimal.Round(_Taxes, 2); } set { _Taxes = value; } }
        public string LastUpdateDate { get; set; }
        public string CentralReservationNumber { get; set; }
        public string PreferredContactMethod { get; set; }
        public string CompRate { get; set; }
        public decimal ResortFee { get { return decimal.Round(_ResortFee, 2); } set { _ResortFee = value; } }
    }
    public class RateRecommendation
    {
        private decimal _singlePrice;
        private decimal _doublePrice;
        private decimal _triplePrice;
        private decimal _quadruplePrice;
        private decimal _extraPrice;
        private decimal _extraYouthPrice;
        public DateTime DateFrom { get; set; }
        public DateTime DateTo { get; set; }
        public string InventoryId { get; set; }
        public string RateId { get; set; }
        public bool ClosedToArrival { get; set; }
        public int MinLengthOfStay { get; set; }
        public decimal SingleRate { get { return decimal.Round(_singlePrice, 2); } set { _singlePrice = value; } }
        public decimal DoubleRate { get { return decimal.Round(_doublePrice, 2); } set { _doublePrice = value; } }
        public decimal TripleRate { get { return decimal.Round(_triplePrice, 2); } set { _triplePrice = value; } }
        public decimal QuadrupleRate { get { return decimal.Round(_quadruplePrice, 2); } set { _quadruplePrice = value; } }
        public decimal ExtraRate { get { return decimal.Round(_extraPrice, 2); } set { _extraPrice = value; } }
        public decimal ExtraYouthRate { get { return decimal.Round(_extraYouthPrice, 2); } set { _extraYouthPrice = value; } }
    }