예제 #1
0
        public async Task <ActionResult> Add([FromBody] CartDto cartDto)
        {
            try
            {
                await _cartService.AddAsync(cartDto);
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }

            return(CreatedAtAction(nameof(Add), new { cartDto.Id }, cartDto));
        }
예제 #2
0
        public async Task <ActionResult> Add([FromBody] CategoryDto categoryDto)
        {
            await _categoryService.AddAsync(categoryDto);

            return(CreatedAtAction(nameof(Add), new { categoryDto.Id }, categoryDto));
        }
예제 #3
0
        public async Task <ActionResult> Add([FromBody] ProductDto productDto)
        {
            await _productService.AddAsync(productDto);

            return(CreatedAtAction(nameof(Add), new { productDto.Id }, productDto));
        }