public MovieDTO AddMovie(MovieSimpleDTO movie) { Movie movieToAdd = new Movie() { Title = movie.Title, Description = movie.Description, Duration = movie.Duration, Active = true }; return(_mapper.Map <MovieDTO>(_moviesRepository.InsertMovie(movieToAdd))); }
public MovieDTO EditMovie(long id, MovieSimpleDTO editedMovie) { Movie movieToEdit = _moviesRepository.GetSingleMovie(id).FirstOrDefault(); if (movieToEdit == null) { throw new System.Exception("Object not found"); } movieToEdit.Description = editedMovie.Description; movieToEdit.Duration = editedMovie.Duration; movieToEdit.Title = editedMovie.Title; return(_mapper.Map <MovieDTO>(_moviesRepository.PatchMovie(movieToEdit))); }
public MovieDTO Patch(long id, [FromBody] MovieSimpleDTO movie) { return(_movieService.EditMovie(id, movie)); }
public MovieDTO Post([FromBody] MovieSimpleDTO movie) { return(_movieService.AddMovie(movie)); }