Пример #1
0
        public IHttpActionResult Post([FromBody] Booking booking)
        {
            try
            {
                if (_roomServices.IsNoConflict(booking))
                {
                    _bookingServices.Add(booking);
                    return(Ok());
                }

                var room           = _roomServices.Get(booking.RoomNumber);
                var availableHours = _roomServices.GetAvailableHours(room);
                return(Content(HttpStatusCode.Conflict, availableHours));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }