Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

GdprConsentValidator.cs

using FluentValidation;
using Nop.Core.Domain.Gdpr;
using Nop.Services.Localization;
using Nop.Web.Areas.Admin.Models.Settings;
using Nop.Web.Framework.Validators;

namespace Nop.Web.Areas.Admin.Validators.Settings;

public partial class GdprConsentValidator : BaseNopValidator
{
    public GdprConsentValidator(ILocalizationService localizationService)
    {
        RuleFor(x => x.Message).NotEmpty().WithMessageAwait(localizationService.GetResourceAsync("Admin.Configuration.Settings.Gdpr.Consent.Message.Required"));
        RuleFor(x => x.RequiredMessage)
            .NotEmpty()
            .WithMessageAwait(localizationService.GetResourceAsync("Admin.Configuration.Settings.Gdpr.Consent.RequiredMessage.Required"))
            .When(x => x.IsRequired);

        SetDatabaseValidationRules();
    }
}