コード例 #1
0
        public async Task <IActionResult> Add([FromForm] CreateCategoryDto createcategorydto)
        {
            var createCategoryViewModel = CustomMapper.GetCreateCategoryViewModel(createcategorydto);
            var validationResult        = await _categoryService.Add(createCategoryViewModel);

            if (validationResult.IsValid)
            {
                return(Ok());
            }

            return(BadRequest(validationResult.Errors));
        }