2012-07-16 16:50:44 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2012-07-13 03:50:50 +00:00
|
|
|
|
using System.Linq;
|
2012-08-15 13:20:29 +00:00
|
|
|
|
using MediaBrowser.Common.Net.Handlers;
|
2012-08-17 13:16:50 +00:00
|
|
|
|
using MediaBrowser.Model.DTO;
|
2012-07-13 03:50:50 +00:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Api.HttpHandlers
|
|
|
|
|
{
|
2012-08-17 13:16:50 +00:00
|
|
|
|
public abstract class ItemListHandler : BaseJsonHandler<IEnumerable<BaseItemWrapper<BaseItem>>>
|
2012-07-13 03:50:50 +00:00
|
|
|
|
{
|
2012-08-17 13:16:50 +00:00
|
|
|
|
protected override IEnumerable<BaseItemWrapper<BaseItem>> GetObjectToSerialize()
|
2012-07-13 03:50:50 +00:00
|
|
|
|
{
|
2012-08-15 13:20:29 +00:00
|
|
|
|
return ItemsToSerialize.Select(i =>
|
2012-07-13 03:50:50 +00:00
|
|
|
|
{
|
2012-08-15 13:20:29 +00:00
|
|
|
|
return ApiService.GetSerializationObject(i, false, UserId);
|
2012-07-13 03:50:50 +00:00
|
|
|
|
|
2012-08-15 13:20:29 +00:00
|
|
|
|
});
|
2012-07-13 03:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected abstract IEnumerable<BaseItem> ItemsToSerialize
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
}
|
2012-07-16 16:50:44 +00:00
|
|
|
|
|
|
|
|
|
protected Guid UserId
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Guid.Parse(QueryString["userid"]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-07-13 03:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|