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.
Sonarr/src/NzbDrone.Api/Series/SeriesEditorModule.cs

33 lines
972 B

using System.Collections.Generic;
using System.Linq;
using Nancy;
using Sonarr.Http.Extensions;
using NzbDrone.Core.Tv;
using Sonarr.Http.Mapping;
namespace NzbDrone.Api.Series
{
public class SeriesEditorModule : NzbDroneApiModule
{
private readonly ISeriesService _seriesService;
public SeriesEditorModule(ISeriesService seriesService)
: base("/series/editor")
{
_seriesService = seriesService;
Put["/"] = series => SaveAll();
}
private Response SaveAll()
{
var resources = Request.Body.FromJson<List<SeriesResource>>();
var series = resources.Select(seriesResource => seriesResource.ToModel(_seriesService.GetSeries(seriesResource.Id))).ToList();
return _seriesService.UpdateSeries(series, true)
.ToResource(false)
.AsResponse(HttpStatusCode.Accepted);
}
}
}