public async Task <IActionResult> Put([NotNull][FromBody] FilmModel filmToAdd)
        {
            BlFilmModel film = await _filmsService.AddOrUpdateFilm(Mapper.Map <BlFilmModel>(filmToAdd));

            return(Ok(
                       Mapper.Map <FilmModel>(film)
                       ));
        }
Ejemplo n.º 2
0
        public async Task <FilmModel> AddOrUpdateFilm(FilmModel film)
        {
            int id = await _filmRepository.AddOrUpdateFilm(Mapper.Map <DalFilmModel>(film));

            return(new FilmModel(
                       (id != 0) ? id : film.Id,
                       film.Name,
                       film.Description,
                       film.StartRentDate,
                       film.EndRentDate
                       ));
        }
        public async Task <IActionResult> Get(int id)
        {
            BlFilmModel film = await _filmsService.GetFilmsById(id);

            if (film == null)
            {
                return(NotFound());
            }

            return(Ok(
                       Mapper.Map <FilmModel>(film)
                       ));
        }