Пример #1
0
        public ActionResult <CategoryReadDto> CreateCategory(CategoryCreateDto categoryCreateDto)
        {
            var model = _mapper.Map <Category>(categoryCreateDto);

            _repository.CreateCategory(model);
            _repository.SaveChanges();

            var readDto = _mapper.Map <CategoryReadDto>(model);

            return(CreatedAtRoute(nameof(GetCategoryById), new { Id = readDto.CategoryId }, readDto));
        }