Favorites (#4)
* Added favorites page * Refactor table to a reusable component Reviewed-on: #4 Co-authored-by: Berack96 <giacomobertolazzi7@gmail.com> Co-committed-by: Berack96 <giacomobertolazzi7@gmail.com>
This commit was merged in pull request #4.
This commit is contained in:
@@ -12,42 +12,14 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<table class="table table-striped" id="moviesTable">
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th style="width: 100%;">Title</th>
|
||||
<th>Year</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (movies?.Search != null)
|
||||
{
|
||||
@foreach (var movie in movies.Search)
|
||||
{
|
||||
<tr>
|
||||
<td><button class="btn btn-secondary" @onclick="() => OnMovieSelected(movie.IdIMDB)">Details</button></td>
|
||||
<td>@movie.Title</td>
|
||||
<td>@movie.Year</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<MovieTable Movies="movies" />
|
||||
|
||||
@inject OmdbService OmdbService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
@code {
|
||||
private string searchTitle = "";
|
||||
private MovieSearch? movies = null;
|
||||
|
||||
private async Task OnMovieSelected(string imdbID)
|
||||
{
|
||||
NavigationManager.NavigateTo($"/movie/{imdbID}");
|
||||
}
|
||||
|
||||
private async Task OnSearch()
|
||||
{
|
||||
movies = await OmdbService.FetchMovies(searchTitle);
|
||||
|
||||
Reference in New Issue
Block a user