79 lines
3.4 KiB
Plaintext
79 lines
3.4 KiB
Plaintext
@using WatchIt.Common.Model.Movies
|
|
@using WatchIt.Common.Model.Series
|
|
@using WatchIt.Common.Query
|
|
@using WatchIt.Website.Components.SearchPage
|
|
@using WatchIt.Website.Services.WebAPI.Movies
|
|
|
|
@layout MainLayout
|
|
|
|
@page "/search/{query}"
|
|
|
|
<PageTitle>WatchIt - Searching "@(Query)"</PageTitle>
|
|
|
|
|
|
|
|
<div class="container-grid">
|
|
@if (_loaded)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(_error))
|
|
{
|
|
<div class="row">
|
|
<div class="col">
|
|
<div class="rounded-3 panel panel-regular p-3">
|
|
<div class="d-flex justify-content-center">
|
|
<h3 class="m-0">
|
|
<strong>Search results for phrase:</strong> "@(DecodedQuery)"
|
|
</h3>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row mt-3">
|
|
<div class="col">
|
|
<SearchResultComponent TItem="MovieResponse"
|
|
TQuery="MovieQueryParameters"
|
|
Title="Movies"
|
|
UrlIdTemplate="/media/{0}"
|
|
IdSource="@(item => item.Id)"
|
|
NameSource="@(item => item.Title)"
|
|
AdditionalNameInfoSource="@(item => item.ReleaseDate.HasValue ? $" ({item.ReleaseDate.Value.Year})" : null)"
|
|
RatingSource="@(item => item.Rating)"
|
|
Query="@(new MovieQueryParameters { Title = DecodedQuery, OrderBy = "rating.count" })"
|
|
ItemDownloadingTask="@(MoviesWebAPIService.GetAllMovies)"
|
|
PictureDownloadingTask="@((id, action) => MediaWebAPIService.GetMediaPoster(id, action))"/>
|
|
</div>
|
|
</div>
|
|
<div class="row mt-3">
|
|
<div class="col">
|
|
<SearchResultComponent TItem="SeriesResponse"
|
|
TQuery="SeriesQueryParameters"
|
|
Title="TV series"
|
|
UrlIdTemplate="/media/{0}"
|
|
IdSource="@(item => item.Id)"
|
|
NameSource="@(item => item.Title)"
|
|
AdditionalNameInfoSource="@(item => item.ReleaseDate.HasValue ? $" ({item.ReleaseDate.Value.Year})" : null)"
|
|
RatingSource="@(item => item.Rating)"
|
|
Query="@(new SeriesQueryParameters { Title = DecodedQuery, OrderBy = "rating.count" })"
|
|
ItemDownloadingTask="@(SeriesWebAPIService.GetAllSeries)"
|
|
PictureDownloadingTask="@((id, action) => MediaWebAPIService.GetMediaPoster(id, action))"/>
|
|
</div>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<div class="row">
|
|
<div class="col">
|
|
<ErrorComponent ErrorMessage="@(_error)"/>
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
<div class="row">
|
|
<div class="col">
|
|
<LoadingComponent/>
|
|
</div>
|
|
</div>
|
|
}
|
|
</div> |