public async Task <IActionResult> Create(CategoryDto categoryDto) { var category = _mapper.Map <Category>(categoryDto); var result = await _logic.Create(category); if (!result.Success) { result.AddErrorToModelState(ModelState); return(BadRequest(ModelState)); } _mapper.Map(result.Value, categoryDto); return(CreatedAtAction(nameof(Create), categoryDto)); }