Esempio n. 1
0
        public async Task <ActionResult> UpdateProduct(int Id, ProductDtoForUpdate product)
        {
            try
            {
                await _ProductService.EditProductAsync(Id, product);

                return(NoContent());
            }
            catch (NotFoundException)
            {
                return(NotFound("Jason parameters are not Correct or this Client Id does not exist."));
            }
        }
Esempio n. 2
0
        public async Task EditProductAsync(int Id, ProductDtoForUpdate product)
        {
            try
            {
                var Product = await _iProductRepository.findbyIdAsync(Id);

                // var ProductForUpdateDto = _mapper.Map<ProductDtoForUpdate>(Product);

                _mapper.Map(product, Product);
                _iProductRepository.Edit(Product);

                await _iProductRepository.SaveAsync();
            }
            catch (Exception)
            {
                throw new NotFoundException();
            }
        }