コード例 #1
0
        public async Task <ActionResult <ActorModel[]> > Get()
        {
            try
            {
                var results = await _actorRepository.GetAllActorsAsync();

                if (results.Length == 0)
                {
                    return(NotFound("No actors found."));
                }

                return(Ok(_mapper.Map <ActorModel[]>(results)));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
            }
        }