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)); }
public async Task <IActionResult> UpdateProduct([FromRoute] int id, [FromBody] AddProductResource productResource, CancellationToken cancellationToken = default) { return(Ok(await _productService.UpdateProductAsync(id, productResource, cancellationToken))); }
public async Task <int> CreateProductAsync(AddProductResource product, CancellationToken cancellationToken = default) { var entity = _mapper.Map <Product>(product); return(await _productRepository.CreateAsync(entity, cancellationToken)); }
public async Task <IActionResult> PostProduct([FromBody] AddProductResource productResource, CancellationToken cancellationToken = default) { return(Ok(await _productService.CreateProductAsync(productResource, cancellationToken))); }