You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/Lidarr.Api.V1/Tags/TagResource.cs

49 lines
1.0 KiB

using System.Collections.Generic;
using System.Linq;
using Lidarr.Http.REST;
using NzbDrone.Core.Tags;
namespace Lidarr.Api.V1.Tags
{
public class TagResource : RestResource
{
public string Label { get; set; }
}
public static class TagResourceMapper
{
public static TagResource ToResource(this Tag model)
{
if (model == null)
{
return null;
}
return new TagResource
{
Id = model.Id,
Label = model.Label
};
}
public static Tag ToModel(this TagResource resource)
{
if (resource == null)
{
return null;
}
return new Tag
{
Id = resource.Id,
Label = resource.Label
};
}
public static List<TagResource> ToResource(this IEnumerable<Tag> models)
{
return models.Select(ToResource).ToList();
}
}
}