@inherits Custom.Hybrid.Razor14
<!-- unimportant stuff, hidden -->
@using ToSic.Razor.Blade;
@using System.Linq;
Example from App.Query Queries are pre... <!-- unimportant stuff, hidden -->
@{
// get the query
var query = App.Query["AuthorsWithBooks"];
// get all authors from the stream Authors in the query
var allAuthors = AsList(query["Authors"]);
// get the current author (if available) from the stream Current
var current = AsDynamic(query["Current"].FirstOrDefault());
// get the books of the current author (if available) from stream CurrentBook
var books = AsList(query["CurrentBooks"]);
}
<ul>
@foreach(var person in allAuthors) {
<!-- this li will have class=selected if it's the current one -->
<li class='@(person == current ? "selected" : "")'>
<!-- this creates a link to the current tutorial (data220) and author=id -->
<a href='@Link.To(parameters: "data220=true&authorId=" + person.EntityId)'>
@person.FirstName @person.LastName
</a>
</li>
}
</ul>
@if(current != null) {
if(Text.Has(current.Mugshot)) {
<img loading="lazy" src="@current.Mugshot?w=100&h=100&mode=crop" width="100px" class="person float-right float-end">
}
<h3>Current Author: @current.FirstName @current.LastName</h3>
<strong>Books</strong>
<ol>
@foreach(var book in books) {
<li>@book.Title</li>
}
</ol>
} else {
<h3>No author selected - click on an author above</h3>
}
<!-- unimportant stuff, hidden -->