Ejemplo n.º 1
0
        public IActionResult Create([FromBody] Models.Movies.MovieInputModel model)
        {
            if (model == null)
            {
                return(BadRequest());
            }

            var movie = ToDomainModel(model);

            service.AddMovie(movie);

            var outputModel = ToOutputMovie(movie);

            return(CreatedAtRoute("GetMovie", new { id = outputModel.Id }, outputModel));
        }
Ejemplo n.º 2
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var model = new OtherLayers.Movie
            {
                Id          = this.Movie.Id,
                Title       = this.Movie.Title,
                ReleaseYear = this.Movie.ReleaseYear,
                Summary     = this.Movie.Summary
            };

            service.AddMovie(model);

            return(RedirectToPage("./Index"));
        }