Пример #1
0
        public async Task <IActionResult> Create([FromBody] CategoryModel categoryModel)
        {
            _logger.LogTrace(nameof(Create));

            try
            {
                var category = await _catalogService.CreateCategory(categoryModel);

                return(Created(string.Empty, category));
            }
            catch (ValidationException e)
            {
                return(BadRequest(e.Message));
            }
            catch (Exception e)
            {
                _logger.LogError(e.Message);

                return(StatusCode(StatusCodes.Status500InternalServerError, e));
            }
        }