コード例 #1
0
        public async Task <CategoryServiceResult> GetCategoryAsync(string id)
        {
            try
            {
                var entity = await _categoriesRepository.FindByIdAsReadableAsync(id);

                var model = entity != null
                    ? _mapper.Map(entity, new CategoryServiceResult())
                    : null;

                return(model);
            }
            catch (Exception ex)
            {
                _logger?.LogError(ex.ToString());
                throw;
            }
        }