Added paging to the TV Requests page

This commit is contained in:
Jamie Rees 2018-04-24 14:44:22 +01:00
parent 69e324c670
commit 0b2e488e8f
10 changed files with 73 additions and 17 deletions

View file

@ -130,7 +130,7 @@ namespace Ombi.Core.Engine
var newRequest = tvBuilder.CreateNewRequest(tv);
return await AddRequest(newRequest.NewRequest);
}
public async Task<IEnumerable<TvRequests>> GetRequests(int count, int position)
{
var shouldHide = await HideFromOtherUsers();
@ -280,7 +280,7 @@ namespace Ombi.Core.Engine
results.Background = PosterPathHelper.FixBackgroundPath(request.Background);
results.QualityOverride = request.QualityOverride;
results.RootFolder = request.RootFolder;
await TvRepository.Update(results);
return results;
}
@ -432,6 +432,19 @@ namespace Ombi.Core.Engine
};
}
public async Task<int> GetTotal()
{
var shouldHide = await HideFromOtherUsers();
if (shouldHide.Hide)
{
return await TvRepository.Get(shouldHide.UserId).CountAsync();
}
else
{
return await TvRepository.Get().CountAsync();
}
}
private async Task<RequestEngineResult> AddExistingRequest(ChildRequests newRequest, TvRequests existingRequest)
{
// Add the child