public IActionResult Post(BookingModel bookingModel)
        {
            IActionResult result;

            if (bookingModel.HasErrors())
            {
                result = BadRequest(new ErrorModel(bookingModel.Errors()));
            }
            else
            {
                var booking = BookingLogic.Create(bookingModel.ToEntity(), bookingModel.GetGuests());
                result = Created("GetBooking", new BookingBasicInfoModel(booking));
            }

            return result;
        }
Ejemplo n.º 2
0
 public void ValidBookingModelIsValid()
 {
     Assert.IsFalse(BookingModel.HasErrors());
 }