public async Task <IActionResult> BookARoomAsync([FromBody] Booking booking) { IEnumerable <Room> rooms = await _roomBusiness.GetRoomsAsync(); if (!ModelState.IsValid || rooms.All(r => r.Name != booking.Room.Name)) { return(BadRequest()); } CreatedBooking createdBooking = await _bookingsBusiness.BookARoomAsync(booking); if (createdBooking.Booking == null) { return(Ok(createdBooking)); } return(CreatedAtAction("BookARoomAsync", createdBooking)); }
public async Task <IActionResult> GetRoomsAsync() { IEnumerable <Room> rooms = await _roomsBusiness.GetRoomsAsync(); return(Ok(rooms)); }
public async Task <IActionResult> GetRoomsAsync() { var rooms = _roomsBusiness.GetRoomsAsync(); return(Ok(rooms)); }