コード例 #1
0
        public async Task <int> UpdateProductAsync(int id, AddProductResource product, CancellationToken cancellationToken = default)
        {
            var entity = _mapper.Map <Product>(product);

            entity.ProductId = id;
            return(await _productRepository.UpdateAsync(entity, cancellationToken));
        }
コード例 #2
0
 public async Task <IActionResult> UpdateProduct([FromRoute] int id, [FromBody] AddProductResource productResource, CancellationToken cancellationToken = default)
 {
     return(Ok(await _productService.UpdateProductAsync(id, productResource, cancellationToken)));
 }
コード例 #3
0
        public async Task <int> CreateProductAsync(AddProductResource product, CancellationToken cancellationToken = default)
        {
            var entity = _mapper.Map <Product>(product);

            return(await _productRepository.CreateAsync(entity, cancellationToken));
        }
コード例 #4
0
 public async Task <IActionResult> PostProduct([FromBody] AddProductResource productResource, CancellationToken cancellationToken = default)
 {
     return(Ok(await _productService.CreateProductAsync(productResource, cancellationToken)));
 }