Ejemplo n.º 1
0
        public async Task <ActionResult <TrailerDTO> > GetById(int id)
        {
            try
            {
                var result = await _trailerRepository.GetTrailerById(id);

                var mappedResult = _mapper.Map <TrailerDTO>(result);

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

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