diff --git a/src/NzbDrone.Api/Movies/MovieEditorModule.cs b/src/NzbDrone.Api/Movies/MovieEditorModule.cs new file mode 100644 index 000000000..ca744a099 --- /dev/null +++ b/src/NzbDrone.Api/Movies/MovieEditorModule.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Linq; +using Nancy; +using NzbDrone.Api.Extensions; +using NzbDrone.Core.Tv; + +namespace NzbDrone.Api.Movie +{ + public class MovieEditorModule : NzbDroneApiModule + { + private readonly IMovieService _movieService; + + public MovieEditorModule(IMovieService movieService) + : base("/movie/editor") + { + _movieService = movieService; + Put["/"] = Movie => SaveAll(); + } + + private Response SaveAll() + { + var resources = Request.Body.FromJson>(); + + var Movie = resources.Select(MovieResource => MovieResource.ToModel(_movieService.GetMovie(MovieResource.Id))).ToList(); + + return _movieService.UpdateMovie(Movie) + .ToResource() + .AsResponse(HttpStatusCode.Accepted); + } + } +} diff --git a/src/NzbDrone.Api/NzbDrone.Api.csproj b/src/NzbDrone.Api/NzbDrone.Api.csproj index 2a3dcba5a..5486fe715 100644 --- a/src/NzbDrone.Api/NzbDrone.Api.csproj +++ b/src/NzbDrone.Api/NzbDrone.Api.csproj @@ -119,6 +119,7 @@ +