public async Task <ValidationResult> ValidateUpdateProductBadge(UpdateProductBadgeInput input)
        {
            ValidationResult validationResult = new();

            Product product = await _productRepository.GetAsync(input.ProductId);

            if (product is null)
            {
                validationResult.Messages.Add(new(nameof(UpdateProductBadgeInput.ProductId), "El producto no existe."));
            }

            return(validationResult);
        }
        public async Task <OperationResult <ProductDto> > UpdateProductBadgeAsync(UpdateProductBadgeInput input)
        {
            ValidationResult validationResult = await _validator.ValidateUpdateProductBadge(input);

            if (validationResult.IsSuccess)
            {
                Product product = await _repository.GetAsync(input.ProductId);

                product.PercentageOff = input.PercentageOff;

                await _repository.UpdateAsync(product);

                ProductBadge badge = await _badgeRepository.GetByProduct(product);

                if (badge is null)
                {
                    badge = new()
                    {
                        ProductId = input.ProductId,
                        Badges    = input.Badges
                    };

                    await _badgeRepository.CreateAsync(badge);
                }
                else
                {
                    badge.Badges = input.Badges;
                    await _badgeRepository.UpdateAsync(badge);
                }

                return(OperationResult <ProductDto> .Success(product.ConvertToDto()));
            }
            else
            {
                return(OperationResult <ProductDto> .Fail(validationResult));
            }
        }
        public async Task <IActionResult> UpdateBadge(UpdateProductBadgeInput input)
        {
            var result = await _productService.UpdateProductBadgeAsync(input);

            return(new OperationActionResult(result));
        }