/// <summary> /// Records that a guest is checked into the room. /// </summary> /// <param name="guest">The guest to check into the room</param> /// <returns>The guest id</returns> public async Task <ResponseModel> CheckIntoRoom(Guest guest) { bool isOccupied = (bool)(await _roomsRepository.GetState(guest.RoomId)).Response; if (isOccupied) { throw new ClientException($"The room [RoomId = {guest.RoomId}] is occupied"); } await _roomsRepository.ChangeRoomStatus(guest.RoomId); await _context.Guests.AddAsync(guest); await _context.SaveChangesAsync(); return(new ResponseModel(guest.Id)); }