public async Task <ProductsResponse> UpdateAsync(int id, Products products) { var existingProducts = await _productRespository.FindByIdAsync(id); if (existingProducts == null) { return(new ProductsResponse("Product not found")); } existingProducts.Name = products.Name; try { _productRespository.Update(existingProducts); await _unitOfWork.CompleteAsync(); return(new ProductsResponse(existingProducts)); } catch (Exception ex) { return(new ProductsResponse($"An error occurred while updating the products:{ex.Message}")); } }