Fixed: Incorrect api error when calling /api/episode without seriesId queryparam.

fixes #1070
This commit is contained in:
Taloth Saldono
2016-01-20 21:49:54 +01:00
parent 5cfaed7b26
commit 2f50074123
3 changed files with 12 additions and 17 deletions
@@ -52,16 +52,16 @@ namespace NzbDrone.Api.EpisodeFiles
private List<EpisodeFileResource> GetEpisodeFiles()
{
var seriesId = (int?)Request.Query.SeriesId;
if (seriesId == null)
if (!Request.Query.SeriesId.HasValue)
{
throw new BadRequestException("seriesId is missing");
}
var series = _seriesService.GetSeries(seriesId.Value);
var seriesId = (int)Request.Query.SeriesId;
return _mediaFileService.GetFilesBySeries(seriesId.Value)
var series = _seriesService.GetSeries(seriesId);
return _mediaFileService.GetFilesBySeries(seriesId)
.Select(f => MapToResource(series, f)).ToList();
}