Exemple #1
0
 public LocalizationController(
     ILocalizationWebApi localizationWebApi,
     ILanguageWebApi languageWebApi,
     ILogger <LocalizationController> logger)
 {
     _localizationWebApi = localizationWebApi;
     _languageWebApi     = languageWebApi;
     _logger             = logger;
 }
        public ContactFormValidator(ILocalizationWebApi localizationWebApi, IWorkContext workContext)
        {
            var languageId = _workContext.Current.WorkingLanguageId;

            RuleFor(x => x.EmailTo).NotEmpty().WithMessage(localizationWebApi.GetResource("Section.ContactForm.EmailTo.Required", languageId).GetAwaiter().GetResult());
            RuleFor(x => x.EmailTo).EmailAddress().WithMessage(localizationWebApi.GetResource("Common.WrongEmail", languageId).GetAwaiter().GetResult());
            RuleFor(x => x.Subject).NotEmpty().WithMessage(localizationWebApi.GetResource("Section.ContactForm.Subject.Required", languageId).GetAwaiter().GetResult());
            _workContext = workContext;
        }
        public ContactFormReadOnlyValidator(ILocalizationWebApi localizationWebApi, IWorkContext workContext)
        {
            var languageId = _workContext.Current.WorkingLanguageId;

            RuleFor(x => x.Name).NotNull()
            .WithMessage(localizationWebApi.GetResource("Section.ContactForm.Name.Required", languageId).GetAwaiter().GetResult())
            .When(x => x.NameEnabled);
            RuleFor(x => x.EmailFrom).NotEmpty().WithMessage(localizationWebApi.GetResource("Section.ContactForm.EmailFrom.Required", languageId).GetAwaiter().GetResult());
            RuleFor(x => x.EmailFrom).EmailAddress().WithMessage(localizationWebApi.GetResource("Common.WrongEmail", languageId).GetAwaiter().GetResult());
            RuleFor(x => x.Message).NotEmpty().WithMessage(localizationWebApi.GetResource("Section.ContactForm.Message.Required", languageId).GetAwaiter().GetResult());
            _workContext = workContext;

            //http://www.beabigrockstar.com/using-fluent-validation-with-asp-net-mvc-part-4-database-validation/
            //Custom(s =>
            //    {
            //        var model = (ContactForm)sectionService.GetById(s.Id);
            //        if(model.ShowName)
            //            RuleFor(x => x.Name).NotEmpty().WithMessage(localizationService.GetResource("Section.ContactForm.Name.Required")).;

            //        return null;
            //    });
        }
Exemple #4
0
 public PdfService(ILocalizationWebApi localizationWebApi, ILanguageWebApi languageWebApi)
 {
     _localizationWebApi = localizationWebApi;
     _languageWebApi     = languageWebApi;
 }
Exemple #5
0
 public ExportManager(ILocalizationWebApi localizationWebApi, ILanguageWebApi languageWebApi)
 {
     this._localizationWebApi = localizationWebApi;
     this._languageWebApi     = languageWebApi;
 }