Example #1
0
        public IActionResult PostFilm([FromBody] Models.Film film)
        {
            if (film == null)
            {
                return(BadRequest("Film is null."));
            }

            var eFilm = mapModelToEntity.ConvertObject(film);

            _service.Create(eFilm);

            return(Ok("Successfully added!"));
        }
Example #2
0
        public IActionResult PutFilm([FromRoute] int id, [FromBody] Models.Film filmUpdated)
        {
            if (filmUpdated == null)
            {
                return(BadRequest("Film is null."));
            }

            var film = _service.Get(id);

            if (film == null)
            {
                return(NotFound("Film couldn't be found."));
            }

            var mFilm = mapModelToEntity.ConvertObject(filmUpdated);

            _service.Update(film, mFilm);

            return(NoContent());
        }