示例#1
0
 public async Task <IHttpActionResult> CreateReservation([FromBody] ReservationRequest request)
 {
     try
     {
         var response = new Pricing
         {
             ProductID  = 1,
             DailyPrice = PricingLogic.GetAverageDailyPrice(request.Checkin, request.Checkout)
         };
         return(Json(response));
     }
     catch (HttpRequestException httpRequestException)
     {
         return(BadRequest("Error: " + httpRequestException.Message));
     }
 }
示例#2
0
        public async Task <IHttpActionResult> GetPricing(DateTime checkin, DateTime checkout)
        {
            try
            {
                var response = new Pricing
                {
                    ProductID = 1,
                    // DailyPrice = (decimal)(totalCost / (checkout - checkin).TotalDays)
                    DailyPrice = PricingLogic.GetAverageDailyPrice(checkin, checkout)
                };
                return(Ok(response));
            }

            catch (HttpRequestException httpRequestException)
            {
                return(BadRequest("Error: " + httpRequestException.Message));
            }
        }