Beispiel #1
0
        public async Task <IActionResult> Get(int id)
        {
            var model = await _repository.GetById(id);

            if (model == null)
            {
                _logger.LogWarning(LogEventId, $"NOT FOUND : ID ({id})");
                return(NotFound(_response
                                .AddWarning(_localizer["IdNotFound"])
                                .Get()));
            }

            _logger.LogTrace(LogEventId, AwesomeMethods.ConvertDataForLog(model, _converter));

            return(Ok(_response
                      .AddData(Mapper.Map <TViewModel>(model))
                      .Get()));
        }