Beispiel #1
0
        public async Task <ActionResult <Hero> > Get(Guid key)
        {
            try
            {
                var heroEntity = await _heroesRepository.Find(key).ConfigureAwait(false);

                if (heroEntity == null)
                {
                    return(NotFound());
                }
                return(Mapper.Map <Hero>(heroEntity));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Failure retrieving hero.");
                return(StatusCode(Status500InternalServerError));
            }
        }