Exemplo n.º 1
0
        public async Task <ActionResult <IList <ActorDTO> > > GetByMovie([FromQuery] string movie)
        {
            try
            {
                var result = await _actorRepository.GetActorsByMovie(movie);

                var mappedResults = _mapper.Map <IList <ActorDTO> >(result).Select(a => HateoasMainLinks(a));

                if (result.Count == 0)
                {
                    return(NotFound(result));
                }
                return(Ok(mappedResults));
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database failure: {e.Message}"));
            }
        }