From 0ec2ab5b7b4d34c2ed3ba9dabed73db5dfa7f6f2 Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Sun, 19 Aug 2012 20:13:51 -0400 Subject: [PATCH] Change LocalTrailers to use DTO return type --- MediaBrowser.Api/ApiService.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Api/ApiService.cs b/MediaBrowser.Api/ApiService.cs index 765c6af1a7..3878389df5 100644 --- a/MediaBrowser.Api/ApiService.cs +++ b/MediaBrowser.Api/ApiService.cs @@ -39,7 +39,7 @@ namespace MediaBrowser.Api dto.Id = item.Id; dto.IsNew = item.IsRecentlyAdded(user); dto.IndexNumber = item.IndexNumber; - dto.IsFolder = item is Folder; + dto.IsFolder = item.IsFolder; dto.LocalTrailerCount = item.LocalTrailers == null ? 0 : item.LocalTrailers.Count(); dto.Name = item.Name; dto.OfficialRating = item.OfficialRating; @@ -139,7 +139,10 @@ namespace MediaBrowser.Api dto.Children = await Task.WhenAll(children.Select(c => GetDTOBaseItem(c, user, false, false))); } - dto.LocalTrailers = item.LocalTrailers; + if (item.LocalTrailers != null && item.LocalTrailers.Any()) + { + dto.LocalTrailers = await Task.WhenAll(item.LocalTrailers.Select(c => GetDTOBaseItem(c, user, false, false))); + } } private static async Task AttachPeople(DTOBaseItem dto, BaseItem item)