Skip to content

Instantly share code, notes, and snippets.

@ScottBurfieldMills
Created June 6, 2020 10:22
Show Gist options
  • Save ScottBurfieldMills/a83b5b40f57c1558dbd5a8bc5ae697c3 to your computer and use it in GitHub Desktop.
Save ScottBurfieldMills/a83b5b40f57c1558dbd5a8bc5ae697c3 to your computer and use it in GitHub Desktop.
@using CastCompare.Data
@using CastCompare.Pages
@inject ITvDbService TvDbService
<div class="row">
<div class="col-md-2">
<BlazoredTypeahead SearchMethod="@SearchShows"
@bind-Values="@SelectedTvShows"
Placeholder="Search for a TV show"
MinimumLength="3"
Debounce="200">
<SelectedTemplate Context="series">
<img src="@series.Banner" width="50" alt="@series.Banner" />
@series.Title
</SelectedTemplate>
<ResultTemplate Context="series">
<img src="@series.Banner" width="50" alt="@series.Banner" />
@series.Title
</ResultTemplate>
<NotFoundTemplate>
None found
</NotFoundTemplate>
</BlazoredTypeahead>
</div>
</div>
@code {
[Parameter]
public IList<TvSearchResult> SelectedTvShows { get; set; }
private async Task<IEnumerable<TvSearchResult>> SearchShows(string searchText)
{
var results = await TvDbService.SearchAsync(searchText);
return results;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment