示例#1
0
        public async Task <ActionResult <ActorDTO> > GetActorById(int id)
        {
            try
            {
                var result = await _actorRepository.GetActorsById(id);

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

                var mappedResults = _mapper.Map <ActorDTO>(result);

                return(Ok(HateoasGetSingleMethodLinks(mappedResults)));
            }

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