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)); } }
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)); } }