public DayDishesController(AppDbContext context, IDayDishesRepository daydishrepo, ILogger <CompanyUser> logger, SharedViewLocalizer localizer) { _context = context; _dayDishesRepo = daydishrepo; _logger = logger; _localizer = localizer; }
public static string GetDisplayValue(T value, SharedViewLocalizer localizer = null) { var fieldInfo = value.GetType().GetField(value.ToString()); var descriptionAttributes = fieldInfo.GetCustomAttributes( typeof(DisplayAttribute), false); if (descriptionAttributes.Length > 0) { var dispattr = descriptionAttributes[0] as DisplayAttribute; if (dispattr.ResourceType != null) { return(lookupResource(dispattr.ResourceType, dispattr.Name)); } if (localizer != null) { return(localizer[dispattr.Name]); } } if (localizer != null) { return(localizer[value.ToString()]); } return(value.ToString()); }
public BrandController(IBrandService brandService, SharedViewLocalizer <CommonResource> localizer, SharedViewLocalizer <BrandResource> brandLocalizer, DataContext context) { _brandService = brandService; _brandLocalizer = brandLocalizer; _localizer = localizer; _context = context; }
public StockValidator(IStockService stockService, SharedViewLocalizer <StockValidatorResource> localizer) { RuleFor(x => x.Quantity).GreaterThanOrEqualTo(1).WithMessage(localizer.GetLocalizedString("msg_NumberMustBeGreaterThanOrEqualToOne")); RuleFor(x => x.Quantity).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.ProductId).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.StoreId).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); }
public DishRepository(AppDbContext context, ILogger <HotelUser> logger, SharedViewLocalizer localizer, IMemoryCache cache) { _context = context; _logger = logger; _localizer = localizer; _cache = cache; }
public LoginValidator(IUserService userService, SharedViewLocalizer <LoginValidatorResource> localizer) { RuleFor(x => x.Email).Length(1, 100).WithMessage(localizer.GetLocalizedString("msg_LengthFrom1To100Characters")); RuleFor(x => x.Email).EmailAddress().NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.Email).EmailAddress().WithMessage(localizer.GetLocalizedString("msg_EmailIsNotAvalidEmailAddress")); RuleFor(x => x.PassWord).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.PassWord).MinimumLength(6).WithMessage(localizer.GetLocalizedString("msg_MinimumLengthOf6Characters")); RuleFor(x => x.PassWord).Matches("^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$").WithMessage(localizer.GetLocalizedString("msg_PasswordMustContainBothLetterSandNumbers.")); }
public ComplexController(AppDbContext context, IComplexRepository complexRepo, ILogger <ComplexController> logger, IConfiguration Configuration, SharedViewLocalizer localizer) { _context = context; _complexRepo = complexRepo; _logger = logger; _configuration = Configuration; _localizer = localizer; int.TryParse(_configuration["SQL:PageRecords"], out pageRecords); }
public ProductValidator(SharedViewLocalizer <ProductValidatorResource> localizer, IProductService productSerive) { RuleFor(x => x.BrandId).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.CategoryId).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.ListPrice).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.ModelYear).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.PictureFile).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.ProductName).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); }
public ServiceRepository(AppDbContext context, ILogger <ServiceRepository> logger, UserManager <HotelUser> userManager, IMemoryCache cache, SharedViewLocalizer localizer) { _context = context; _logger = logger; _userManager = userManager; _cache = cache; _localizer = localizer; }
public UserController( IUserService userService, IStoreService storeService, SharedViewLocalizer <CommonResource> localizer ) { _userService = userService; _storeService = storeService; _localizer = localizer; }
public StockController(IStockService stockService, IStoreService storeService, IProductService productService, SharedViewLocalizer <CommonResource> localizer ) { _stockService = stockService; _storeService = storeService; _productService = productService; _localizer = localizer; }
public AccountController(AppDbContext context, UserManager <HotelUser> userManager, SignInManager <HotelUser> signInManager, ILogger <HotelUser> logger, ICompanyUserRepository companyuser_repo, SharedViewLocalizer localizer) { _context = context; _userManager = userManager; _signInManager = signInManager; _logger = logger; _companyuser_repo = companyuser_repo; _localizer = localizer; }
public PersonsController(IPersonServices personService, LinkGenerator linkGanarator, ILoggerService logger, IFileService fileService, IRelatedPersonServices relatedPersonServices, SharedViewLocalizer localizer) { _personService = personService; _linkGanarator = linkGanarator; _logger = logger; _fileService = fileService; _relatedPersonServices = relatedPersonServices; _localizer = localizer; var test = _localizer["Email"].Value; }
public ProductController(IProductService productService, IBrandService brandService, ICategoryService categoryService, SharedViewLocalizer <CommonResource> localizer, SharedViewLocalizer <ProductResource> productLocalizer) { _productService = productService; _brandService = brandService; _categoryService = categoryService; _localizer = localizer; }
public PasswordValidator(IUserService userService, SharedViewLocalizer <PasswordValidatorResource> localizer) { RuleFor(x => x.NewPassword).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.NewPassword).MinimumLength(6).WithMessage(localizer.GetLocalizedString("msg_MinimumLengthOf6Characters")); RuleFor(x => x.NewPassword).Matches("^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$").WithMessage(localizer.GetLocalizedString("msg_PasswordMustContainBothLetterSandNumbers.")); RuleFor(x => x.ConfirmPassword).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.ConfirmPassword).MinimumLength(6).WithMessage(localizer.GetLocalizedString("msg_MinimumLengthOf6Characters")); RuleFor(x => x.ConfirmPassword).Matches("^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$").WithMessage(localizer.GetLocalizedString("msg_PasswordMustContainBothLetterSandNumbers.")); RuleFor(x => x.ConfirmPassword).Equal(x => x.NewPassword) .WithMessage(localizer.GetLocalizedString("msg_ThePasswordDoesNotMatch")); }
public GenericModelRepository(AppDbContext context, SharedViewLocalizer localizer, ILogger <GenericModelRepository <TModel> > logger, IHttpContextAccessor httpcontext, IServiceProvider serviceProvider, IUserContext usercontext = null) { _context = context; _localizer = localizer; _logger = logger; _httpcontext = httpcontext; _usercontext = usercontext; // for unit tests _serviceProvider = serviceProvider; }
public PaymentController(AppDbContext context, ILogger <CompanyUser> logger, ICompanyUserRepository companyuser_repo, IUserFinRepository fin, SharedViewLocalizer localizer) { _context = context; _logger = logger; _fin = fin; _localizer = localizer; }
public DishController(AppDbContext context, IDishRepository dishesRepo, ILogger <DishController> logger, IConfiguration Configuration, SharedViewLocalizer localizer) { _context = context; _logger = logger; _configuration = Configuration; _dishesRepo = dishesRepo; _localizer = localizer; int.TryParse(_configuration["SQL:PageRecords"], out pageRecords); }
public StoreValidator(IStoreService storeService, IUserService userService, SharedViewLocalizer <StoreValidatorResource> localizer) { RuleFor(x => x.Email).Must((reg, c) => !storeService.IsExistedEmailStore(reg.Id, reg.Email)) .WithMessage(localizer.GetLocalizedString("msg_EmailAlreadyExists")); RuleFor(x => x.Email).Must((reg, c) => !userService.IsExistedEmailUser(reg.Id, reg.Email)) .WithMessage(localizer.GetLocalizedString("msg_EmailAlreadyExists")); RuleFor(x => x.StoreName).Length(1, 100).WithMessage(localizer.GetLocalizedString("msg_LengthFrom1To100Characters")); RuleFor(x => x.StoreName).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.Email).Length(1, 100).WithMessage(localizer.GetLocalizedString("msg_LengthFrom1To100Characters")); RuleFor(x => x.Email).EmailAddress().NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.Email).EmailAddress().WithMessage(localizer.GetLocalizedString("msg_EmailIsNotAvalidEmailAddress")); RuleFor(x => x.Phone).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); }
//private readonly IUserDayDishesRepository _udaydishrepo; public UserDayDishesController(AppDbContext context, IUserDayDishesRepository ud, UserManager <CompanyUser> um, ILogger <CompanyUser> logger, IEmailService email, IInvoiceRepository invoicerepo, SharedViewLocalizer localizer) { _context = context; _userManager = um; _userdaydishesrepo = ud; _logger = logger; _email = email; _invoicerepo = invoicerepo; _localizer = localizer; // _udaydishrepo = udaydishrepo; }
public UserValidator(IUserService userService, SharedViewLocalizer <UserResource> localizer) { RuleFor(x => x.Email).Must((reg, c) => !userService.IsExistedEmailUser(reg.Id, reg.Email)) .WithMessage(localizer.GetLocalizedString("msg_EmailAlreadyExists")); RuleFor(x => x.Name).Length(1, 100).WithMessage(localizer.GetLocalizedString("msg_LengthFrom1To100Characters")); RuleFor(x => x.Name).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.PassWord).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.PassWord).MinimumLength(6).WithMessage(localizer.GetLocalizedString("msg_MinimumLengthOf6Characters")); RuleFor(x => x.PassWord).Matches("^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$").WithMessage(localizer.GetLocalizedString("msg_PasswordMustContainBothLetterSandNumbers.")); RuleFor(x => x.Email).Length(1, 100).WithMessage(localizer.GetLocalizedString("msg_LengthFrom1To100Characters")); RuleFor(x => x.Email).EmailAddress().NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.Email).EmailAddress().WithMessage(localizer.GetLocalizedString("msg_EmailIsNotAvalidEmailAddress")); RuleFor(x => x.Phone).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); RuleFor(x => x.IsActiver).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); }
public UserController( IUserService userService, IStoreService storeService, SharedViewLocalizer <CommonResource> localizer, SharedViewLocalizer <PasswordResource> passwordLocalizer, SharedViewLocalizer <UserResource> userLocalizer ) { _userService = userService; _storeService = storeService; _localizer = localizer; _passwordLocalizer = passwordLocalizer; _userLocalizer = userLocalizer; }
public UserControllerTest() { _dataContext = TestHelpers.GetDataContext(); AutoMapperConfig.Initialize(); var mapper = AutoMapperConfig.GetMapper(); var options = Options.Create(new LocalizationOptions()); // you should not need any params here if using a StringLocalizer<T> var factory = new ResourceManagerStringLocalizerFactory(options, NullLoggerFactory.Instance); var userService = new UserService(_dataContext, mapper); var storeService = new StoreService(_dataContext, mapper); var localizer = new SharedViewLocalizer <CommonResource>(factory); var httpContext = new DefaultHttpContext(); var tempData = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>()) { ["Successfuly"] = localizer.GetLocalizedString("msg_AddSuccessfuly") }; _userController = new UserController(userService, storeService, localizer) { TempData = tempData }; }
public BrandController(IBrandService brandService, SharedViewLocalizer <CommonResource> localizer) { _brandService = brandService; _localizer = localizer; }
public CategoryValidator(SharedViewLocalizer <CategoryResource> localizer, ICategoryService categoryService) { RuleFor(x => x.CategoryName).Must((reg, c) => !categoryService.IsExistedName(reg.Id, reg.CategoryName)) .WithMessage(localizer.GetLocalizedString("msg_NameCategoryAlreadyExists")); RuleFor(x => x.CategoryName).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); }
public StoreController(IStoreService storeService, SharedViewLocalizer <CommonResource> localizer, SharedViewLocalizer <StoreResource> storeLocalizer) { _storeService = storeService; _localizer = localizer; _storeLocalizer = storeLocalizer; }
public BrandValidator(SharedViewLocalizer <BrandResource> localizer, IBrandService brandService) { RuleFor(x => x.BrandName).Must((reg, c) => !brandService.IsExistedName(reg.Id, reg.BrandName)) .WithMessage((reg, c) => string.Format(localizer.GetLocalizedString("msg_NameBrandAlreadyExists"), c)); RuleFor(x => x.BrandName).NotNull().WithMessage(localizer.GetLocalizedString("msg_NotEmpty")); }
public static IList <string> GetDisplayValues(Enum value, SharedViewLocalizer localizer = null) { return(GetNames(value).Select(obj => GetDisplayValue(Parse(obj), localizer)).ToList()); }
public static IEnumerable <SelectListItem> GetSelectListWithIntegerValues(T value, SharedViewLocalizer localizer = null) { return(EnumHelper <T> .GetValues().Select(s => new SelectListItem() { Text = EnumHelper <T> .GetDisplayValue(s, localizer), Value = Convert.ToInt32(s).ToString(), Selected = Convert.ToInt32(value) == Convert.ToInt32(s) })); }
public CategoryController(ICategoryService category, SharedViewLocalizer <CommonResource> localizer, SharedViewLocalizer <CategoryResource> categoryLocalizer) { _category = category; _localizer = localizer; _categoryLocalizer = categoryLocalizer; }