public async Task <WaitingRoomModel> GetRoomDetails(int RoomId) { WaitingRoom roomDetail = await _dbContext.WaitingRooms.Where(item => item.Id == RoomId).FirstOrDefaultAsync(); if (roomDetail != null) { var roomElements = await _dbContext.WaitingRoomElement.Where(item => item.WaitingRoomId == roomDetail.Id).ToListAsync(); var waitingRoom = roomDetail.MapTo <WaitingRoomModel>(); foreach (WaitingRoomElements em in roomElements) { waitingRoom.Elements.Add(em.MapTo <ElementModel>()); } waitingRoom.Path = $"/room/{waitingRoom.Id}/{waitingRoom.RoomName}"; return(waitingRoom); } return(null); }