Beispiel #1
0
        public async Task <ActionResult <CategoryDto> > CreateCategory([FromBody] CategoryDto categoryDto)
        {
            if (categoryDto == null)
            {
                return(BadRequest("Category data must be set!"));
            }
            try
            {
                CategoryDto created = await _service.CreateCategoryAsync(categoryDto);

                return(Ok(created));
            }
            catch (Exception e)
            {
                return(Conflict(e.Message));
            }
        }