Esempio n. 1
0
        public async Task <IActionResult> CreateMovie([FromBody] MovieCreate createModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            try
            {
                Movie movie = await _movieData.CreateMovie(createModel);

                return(CreatedAtRoute("GetMovie", new { id = movie.Id }, movie));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }