Radarr/src/Radarr.Api.V3/Profiles/Languages/LanguageModule.cs

39 lines
1.0 KiB
C#
Raw Normal View History

2018-11-23 07:03:32 +00:00
using System.Collections.Generic;
using System.Linq;
using NzbDrone.Core.Languages;
2018-11-23 07:03:32 +00:00
using Radarr.Http;
namespace Radarr.Api.V3.Profiles.Languages
2018-11-23 07:03:32 +00:00
{
public class LanguageModule : RadarrRestModule<LanguageResource>
{
public LanguageModule()
{
GetResourceAll = GetAll;
GetResourceById = GetById;
}
private LanguageResource GetById(int id)
{
var language = (Language)id;
return new LanguageResource
{
Id = (int)language,
Name = language.ToString()
};
}
private List<LanguageResource> GetAll()
{
return Language.All.Select(l => new LanguageResource
{
Id = (int)l,
Name = l.ToString()
})
2018-11-23 07:03:32 +00:00
.OrderBy(l => l.Name)
.ToList();
}
}
}