ItemListHandler.cs 784 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using MediaBrowser.Common.Net.Handlers;
  5. using MediaBrowser.Model.Entities;
  6. namespace MediaBrowser.Api.HttpHandlers
  7. {
  8. public abstract class ItemListHandler : BaseJsonHandler
  9. {
  10. protected override object GetObjectToSerialize()
  11. {
  12. return ItemsToSerialize.Select(i =>
  13. {
  14. return ApiService.GetSerializationObject(i, false, UserId);
  15. });
  16. }
  17. protected abstract IEnumerable<BaseItem> ItemsToSerialize
  18. {
  19. get;
  20. }
  21. protected Guid UserId
  22. {
  23. get
  24. {
  25. return Guid.Parse(QueryString["userid"]);
  26. }
  27. }
  28. }
  29. }