aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/HttpHandlers/UserHandler.cs
blob: 706908da2f62a1ee4f60bba8d198c1ca55220d36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using MediaBrowser.Common.Net.Handlers;
using MediaBrowser.Model.DTO;
using MediaBrowser.Model.Entities;
using System.Threading.Tasks;

namespace MediaBrowser.Api.HttpHandlers
{
    class UserHandler : BaseSerializationHandler<DTOUser>
    {
        protected override Task<DTOUser> GetObjectToSerialize()
        {
            string id = QueryString["id"];

            User user = string.IsNullOrEmpty(id) ? ApiService.GetDefaultUser(false) : ApiService.GetUserById(id, false); ;

            DTOUser dto = ApiService.GetDTOUser(user);

            return Task.FromResult<DTOUser>(dto);
        }
    }
}