Exemplo n.º 1
0
        public async Task <IActionResult> Create([FromBody] Film film)
        {
            _logger.LogInformation("Create film.");
            if (!ModelState.IsValid)
            {
                _logger.LogWarning("Create film: model state is not valid.");
                return(BadRequest(ModelState));
            }
            await _films.CreateFilmAsync(film);

            _logger.LogInformation($"Create film: film with Id equal {film.Id} was created.");
            return(CreatedAtAction("GetFilm", new { id = film.Id }, film));
        }