FruitBank/Presentation/Nop.Web/Validators/Vendors/ApplyVendorValidator.cs

19 lines
755 B
C#

using FluentValidation;
using Nop.Services.Localization;
using Nop.Web.Framework.Validators;
using Nop.Web.Models.Vendors;
namespace Nop.Web.Validators.Vendors;
public partial class ApplyVendorValidator : BaseNopValidator<ApplyVendorModel>
{
public ApplyVendorValidator(ILocalizationService localizationService)
{
RuleFor(x => x.Name).NotEmpty().WithMessageAwait(localizationService.GetResourceAsync("Vendors.ApplyAccount.Name.Required"));
RuleFor(x => x.Email).NotEmpty().WithMessageAwait(localizationService.GetResourceAsync("Vendors.ApplyAccount.Email.Required"));
RuleFor(x => x.Email)
.IsEmailAddress()
.WithMessageAwait(localizationService.GetResourceAsync("Common.WrongEmail"));
}
}