Exemple #1
0
        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)));
        }
Exemple #2
0
        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)));
        }
Exemple #3
0
 public MovieDTO Patch(long id, [FromBody] MovieSimpleDTO movie)
 {
     return(_movieService.EditMovie(id, movie));
 }
Exemple #4
0
 public MovieDTO Post([FromBody] MovieSimpleDTO movie)
 {
     return(_movieService.AddMovie(movie));
 }