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;
|
|
|
|
|
using MediaBrowser.Common.Net;
|
|
|
|
|
using MediaBrowser.Common.Net.Handlers;
|
|
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Api.HttpHandlers
|
|
|
|
|
{
|
|
|
|
|
public abstract class ItemListHandler : JsonHandler
|
|
|
|
|
{
|
|
|
|
|
public ItemListHandler(RequestContext ctx)
|
|
|
|
|
: base(ctx)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected sealed override object ObjectToSerialize
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return ItemsToSerialize.Select(i =>
|
|
|
|
|
{
|
2012-07-16 16:50:44 +00:00
|
|
|
|
return ItemHandler.GetSerializationObject(i, false, UserId);
|
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
|
|
|
|
}
|
|
|
|
|
}
|