Ejemplo n.º 1
0
        public async Task <ActionResult <IList <TrailerDTO> > > GetTrailerByTitle([FromQuery] string name)
        {
            try
            {
                var results = await _trailerRepository.GetTrailerByTitle(name);

                var mappedResults = _mapper.Map <IList <TrailerDTO> >(results);

                if (mappedResults.IsNullOrEmpty())
                {
                    return(NotFound());
                }

                return(Ok(mappedResults));
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database failure: {e.Message}"));
            }
        }