public ActionProductValidator(IProductServices _productServices, ResourcesServices _resourcesServices) { RuleFor(x => x.ProductName).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.ListPrice).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.ModelYear).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.Picture).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); }
/// <summary> /// /// </summary> /// <param name="stockServices">declare stockServices</param> public StockController(IStockServices stockServices, IProductServices productServices, IStoreServices storeServices, ResourcesServices resourcesServices) { _stockServices = stockServices; _productServices = productServices; _storeServices = storeServices; _resourcesServices = resourcesServices; }
/// <summary> /// /// </summary> /// <param name="productServices">declare productServices</param> public ProductController(IProductServices productServices, IBrandServices brandServices, ICategoryServices categoryServices, ResourcesServices resourcesServices) { _productServices = productServices; _brandServices = brandServices; _categoryServices = categoryServices; _resourcesServices = resourcesServices; }
public BrandController(IBrandServices brandServices, ResourcesServices <CommonResources> commonLocalizer, ResourcesServices <BrandResources> brandLocalizer) { _brandServices = brandServices; _commonLocalizer = commonLocalizer; _brandLocalizer = brandLocalizer; }
public CategoryController(ICategoryServices categoryServices, ResourcesServices <CommonResources> commonLocalizer, ResourcesServices <CategoryResources> categoryLocalizer) { _categoryServices = categoryServices; _categoryLocalizer = categoryLocalizer; _commonLocalizer = commonLocalizer; }
public LoginController(IUserServices userServices, ILoginServices loginServices, ResourcesServices <UserResources> userLocalizer) { _userLocalizer = userLocalizer; _userServices = userServices; _loginServices = loginServices; }
public StockValidator(ResourcesServices <StockResources> localizer, ResourcesServices <CommonResources> commonlocalizer) { RuleFor(x => x.Quantity).NotNull() .WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_NotEmpty")); RuleFor(x => x.Quantity).GreaterThanOrEqualTo(1) .WithMessage(localizer.GetLocalizedHtmlString("msg_QuantityGreaterThan1")); }
public BrandValidator(ResourcesServices <CommonResources> commonlocalizer, IBrandServices brandService) { RuleFor(x => x.BrandName).NotNull() .WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_NotEmpty")); RuleFor(x => x.BrandName).Must((reg, c) => !brandService.IsExistedName(reg.BrandName, reg.Id)) .WithMessage((reg, c) => string.Format(commonlocalizer.GetLocalizedHtmlString("msg_AlreadyExists"), c)); }
public StoreController(IStoreServices storeService, ResourcesServices <CommonResources> commonLocalizer, ResourcesServices <StoreResources> storeLocalizer) { _commonLocalizer = commonLocalizer; _storeService = storeService; _storeLocalizer = storeLocalizer; }
public CategoryValidator(ResourcesServices <CommonResources> commonlocalizer, ICategoryServices categoryServices) { RuleFor(x => x.CategoryName).NotNull() .WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_NotEmpty")); RuleFor(x => x.CategoryName).Must((reg, c) => !categoryServices.IsExistedName(reg.CategoryName, reg.Id)) .WithMessage((reg, c) => string.Format(commonlocalizer.GetLocalizedHtmlString("msg_AlreadyExists"), c)); }
public UserController( IUserServices userService, IStoreServices storeServices, ResourcesServices <CommonResources> commonLocalizer) { _userServices = userService; _storeServices = storeServices; _commonLocalizer = commonLocalizer; }
public EditUserValidator(ResourcesServices _resourcesServices) { RuleFor(x => x.FullName).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.FullName).Length(1, 100).WithMessage(_resourcesServices.GetLocalizedHtmlString("To 1 between 100 characters")); RuleFor(x => x.Phone).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.IsActive).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.Address).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.StoreId).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.Picture).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); }
public CategoryValidator(ResourcesServices _resourcesServices, ICategoryServices _categoryServices) { var categories = _categoryServices.GetCategories(); foreach (var category in categories) { RuleFor(x => x.CategoryName).NotEqual(category.CategoryName).WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_alreadyexists")); } RuleFor(x => x.CategoryName).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); }
public EditUserValidator(ResourcesServices _resourcesServices) { RuleFor(x => x.FullName).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); RuleFor(x => x.FullName).Length(1, 100).WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_toonefromonehundred")); RuleFor(x => x.Phone).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); RuleFor(x => x.IsActive).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); RuleFor(x => x.Address).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); RuleFor(x => x.StoreId).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); RuleFor(x => x.Picture).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); }
public EditStoreValidator(ResourcesServices _resourcesServices) { RuleFor(x => x.StoreName).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.Phone).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.Email).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.Email).EmailAddress().WithMessage(_resourcesServices.GetLocalizedHtmlString("Formatted by email")); RuleFor(x => x.Street).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.City).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.ZipCode).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); }
public LoginVadidator(ResourcesServices _resourcesServices) { RuleFor(x => x.Email).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); RuleFor(x => x.Email).Length(1, 50).WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_toonefrommfifty")); RuleFor(x => x.Email).EmailAddress().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_formatemail")); RuleFor(x => x.PassWord).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); RuleFor(x => x.PassWord).Matches("^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$").WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_letterandnumber")); RuleFor(x => x.PassWord).MaximumLength(100).WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_max100characters")); RuleFor(x => x.PassWord).MinimumLength(6).WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_min6characters")); }
public BrandValidator(ResourcesServices _resourcesServices, IBrandServices _brandServices) { var brands = _brandServices.GetBrands(); foreach (var brand in brands) { RuleFor(x => x.BrandName).NotEqual(brand.BrandName).WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_alreadyexists")); } RuleFor(x => x.BrandName).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); }
public LoginVadidator(ResourcesServices _resourcesServices) { RuleFor(x => x.Email).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.Email).Length(1, 50).WithMessage(_resourcesServices.GetLocalizedHtmlString("To 1 between 50 characters")); RuleFor(x => x.Email).EmailAddress().WithMessage(_resourcesServices.GetLocalizedHtmlString("Formatted by email")); RuleFor(x => x.PassWord).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.PassWord).Matches("^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$").WithMessage(_resourcesServices.GetLocalizedHtmlString("Contain both letters and numbers")); RuleFor(x => x.PassWord).MaximumLength(100).WithMessage(_resourcesServices.GetLocalizedHtmlString("Maxlength 100 characters")); RuleFor(x => x.PassWord).MinimumLength(6).WithMessage(_resourcesServices.GetLocalizedHtmlString("Minlength 6 characters")); }
public ProductValidator(ResourcesServices <CommonResources> commonlocalizer, IProductServices productServices) { RuleFor(x => x.ProductName).NotNull() .WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_NotEmpty")); RuleFor(x => x.ModelYear).NotNull() .WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_NotEmpty")); RuleFor(x => x.ListPrice).NotNull() .WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_NotEmpty")); RuleFor(x => x.ProductName).Must((reg, c) => !productServices.IsExistedName(reg.ProductName, reg.Id)) .WithMessage((reg, c) => string.Format(commonlocalizer.GetLocalizedHtmlString("msg_AlreadyExists"), c)); }
public LoginValidator(ResourcesServices <CommonResources> commonlocalizer) { RuleFor(x => x.Email).NotNull().WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_NotEmpty")); RuleFor(x => x.Password).NotNull().WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_NotEmpty")); RuleFor(x => x.Email).EmailAddress().WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_WithALetter")); RuleFor(x => x.Password).MinimumLength(8).WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_8Characters")); RuleFor(x => x.Password) .Matches("^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$") .WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_LettersAndNumbers")); }
public StockController(IStockServices stockServices, IProductServices productServices, IStoreServices storeServices, ResourcesServices <CommonResources> commonLocalizer, ResourcesServices <StockResources> stockLocalizer ) { _stockServices = stockServices; _productServices = productServices; _storeServices = storeServices; _commonLocalizer = commonLocalizer; _stockLocalizer = stockLocalizer; }
public EditPasswordValidator(ResourcesServices _resourcesServices) { RuleFor(x => x.NewPassword).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.NewPassword).Matches("^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$").WithMessage(_resourcesServices.GetLocalizedHtmlString("Contain both letters and numbers")); RuleFor(x => x.NewPassword).MaximumLength(100).WithMessage(_resourcesServices.GetLocalizedHtmlString("Maxlength 100 characters")); RuleFor(x => x.NewPassword).MinimumLength(6).WithMessage(_resourcesServices.GetLocalizedHtmlString("Minlength 6 characters")); RuleFor(x => x.ConfirmPassword).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.ConfirmPassword).Matches("^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$").WithMessage(_resourcesServices.GetLocalizedHtmlString("Contain both letters and numbers")); RuleFor(x => x.ConfirmPassword).MaximumLength(100).WithMessage(_resourcesServices.GetLocalizedHtmlString("Maxlength 100 characters")); RuleFor(x => x.ConfirmPassword).MinimumLength(6).WithMessage(_resourcesServices.GetLocalizedHtmlString("Minlength 6 characters")); RuleFor(x => x.ConfirmPassword).Equal(x => x.NewPassword) .WithMessage(_resourcesServices.GetLocalizedHtmlString("Confirm Password must equal New Password")); }
public ProductController(IProductServices productServices, ICategoryServices categoryServices, IBrandServices brandServices, ResourcesServices <CommonResources> commonLocalizer, ResourcesServices <ProductResources> productLocalizer ) { _productServices = productServices; _categoryServices = categoryServices; _brandServices = brandServices; _commonLocalizer = commonLocalizer; _productLocalizer = productLocalizer; }
public EditPasswordValidator(ResourcesServices _resourcesServices) { RuleFor(x => x.NewPassword).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); RuleFor(x => x.NewPassword).Matches("^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$").WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_letterandnumber")); RuleFor(x => x.NewPassword).MaximumLength(100).WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_max100characters")); RuleFor(x => x.NewPassword).MinimumLength(6).WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_min6characters")); RuleFor(x => x.ConfirmPassword).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); RuleFor(x => x.ConfirmPassword).Matches("^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$").WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_letterandnumber")); RuleFor(x => x.ConfirmPassword).MaximumLength(100).WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_max100characters")); RuleFor(x => x.ConfirmPassword).MinimumLength(6).WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_min6characters")); RuleFor(x => x.ConfirmPassword).Equal(x => x.NewPassword) .WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_equalpassword")); }
public ProductValidator(ResourcesServices _resourcesServices, IProductServices _productServices) { var products = _productServices.GetProducts(); foreach (var product in products) { RuleFor(x => x.ProductName).NotEqual(product.ProductName).WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_alreadyexists")); } RuleFor(x => x.ProductName).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); RuleFor(x => x.ListPrice).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); RuleFor(x => x.ModelYear).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); RuleFor(x => x.Picture).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("vld_notnull")); }
public IndexValidator(ResourcesServices <CommonResources> commonlocalizer, IUserServices userServices) { RuleFor(x => x.Email).NotNull() .WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_NotEmpty")); RuleFor(x => x.FullName).NotNull() .WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_NotEmpty")); RuleFor(x => x.Phone).NotNull() .WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_NotEmpty")); RuleFor(x => x.Email).Must((reg, c) => !userServices.IsExistedName(reg.Email, reg.Id)) .WithMessage((reg, c) => string.Format(commonlocalizer.GetLocalizedHtmlString("msg_AlreadyExists"), c)); RuleFor(x => x.Email).EmailAddress() .WithMessage(commonlocalizer.GetLocalizedHtmlString("msg_AValidEmail")); }
public IHttpActionResult Get([FromUri] int providerId) { if (providerId == 0) { return(BadRequest($"Provider id cannot be null")); } var result = ResourcesServices.Find(providerId); if (result == null) { return(NotFound()); } return(Ok(result)); }
public IHttpActionResult Search(SearchRequest searchRequest) { if (searchRequest == null) { return(BadRequest("Object cannot be null")); } try { return(Ok(ResourcesServices.Search(searchRequest))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public StoreValidator(ResourcesServices _resourcesServices, IStoreServices _storeServices) { var stores = _storeServices.GetStores(); foreach (var store in stores) { RuleFor(x => x.Email).NotEqual(store.Email).WithMessage(_resourcesServices.GetLocalizedHtmlString("Already exists")); } RuleFor(x => x.StoreName).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.Phone).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.Email).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.Email).EmailAddress().WithMessage(_resourcesServices.GetLocalizedHtmlString("Formatted by email")); RuleFor(x => x.Street).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.City).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.ZipCode).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); }
protected UserValidator(ResourcesServices _resourcesServices) { RuleFor(x => x.Email).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.Email).Length(1, 50).WithMessage(_resourcesServices.GetLocalizedHtmlString("To 1 between 50 characters")); RuleFor(x => x.Email).EmailAddress().WithMessage(_resourcesServices.GetLocalizedHtmlString("Formatted by email")); RuleFor(x => x.PassWord).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.PassWord).Matches("^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$").WithMessage(_resourcesServices.GetLocalizedHtmlString("Contain both letters and numbers")); RuleFor(x => x.PassWord).MaximumLength(100).WithMessage(_resourcesServices.GetLocalizedHtmlString("Maxlength 100 characters")); RuleFor(x => x.PassWord).MinimumLength(6).WithMessage(_resourcesServices.GetLocalizedHtmlString("Minlength 6 characters")); RuleFor(x => x.FullName).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.FullName).Length(1, 100).WithMessage(_resourcesServices.GetLocalizedHtmlString("To 1 between 100 characters")); RuleFor(x => x.Phone).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.Picture).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.IsActive).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.Address).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); RuleFor(x => x.StoreId).NotNull().WithMessage(_resourcesServices.GetLocalizedHtmlString("Not Null")); }