Example #1
0
        public IActionResult EditMovie(ResultsMoviesViewModel movie)
        {
            var isEdited = false;

            if (ModelState.IsValid)
            {
                var editedMovieDto = this.mapper.MapTo <MovieDto>(movie);
                isEdited = this.movieService.EditMovie(editedMovieDto);
            }
            return(this.Json(new JsonResult(new { isEdited })));
        }
Example #2
0
        public IActionResult CreateMovie(ResultsMoviesViewModel newMovie)
        {
            var isCreated = false;

            if (ModelState.IsValid)
            {
                var createdMovieDto = this.mapper.MapTo <MovieDto>(newMovie);
                isCreated = this.movieService.CreateMovie(createdMovieDto);
            }

            return(this.Json(new JsonResult(new { isCreated })));
        }