Esempio n. 1
0
        public async Task <IActionResult> GetStudio(int id)
        {
            var location = GetControllerActionNames();

            try
            {
                _logger.LogInfo($"{location}: Attempted Call for id: {id}");
                var studio = await _studioRepository.FindById(id);

                if (studio == null)
                {
                    _logger.LogWarn($"{location}: Failed to retrieve record with id: {id}");
                    return(NotFound());
                }
                var response = _mapper.Map <StudioDTO>(studio);
                _logger.LogInfo($"{location}: Successfully got record with id: {id}");
                return(Ok(response));
            }
            catch (Exception e)
            {
                return(InternalError($"{location}: {e.Message} - {e.InnerException}"));
            }
        }