public IActionResult Post([FromBody] ReservationDto value) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var room = _roomRepo.Get(value.RoomNumber); if (room == null) { return(BadRequest($"Room {value.RoomNumber} is not exist")); } if (value.ArrivalDate >= value.DepartureDate) { return(BadRequest("Arrival date can not be the same or after the Depature date")); } var guest = _guestRepo.Create( new Guest { Name = value.GuestName, Email = value.GuestEmail, Phone = value.GuestPhone } ); var reservation = _reservationRepo.Book(guest, room, value.ArrivalDate, value.DepartureDate); return(Ok(reservation)); }
async Task _getRoomDetails(ArloSession session, EventSessionVenueDetails venueDetails, bool forceRefresh) { if (session == null || venueDetails == null) { return; } var fieldsLink = venueDetails.Link?.FirstOrDefault(_ => _.Rel == Constants.Rel.VenueRoom); if (fieldsLink == null) { return; } var fields = await GetEntity(fieldsLink.Href, () => _roomRepo.Get(fieldsLink.Href), Constants.Cache.DefaultTimespan, forceRefresh); session.VenueDetails.VenueRoom = fields; }
public IActionResult Get() { return(Ok(_roomRepo.Get())); }