Example #1
0
 public BrandViewModelService(
     IBrandService brandService,
     IBrandLayoutService brandLayoutService,
     ICustomerService customerService,
     ISlugService slugService,
     IPictureService pictureService,
     ITranslationService translationService,
     IDiscountService discountService,
     ICustomerActivityService customerActivityService,
     IDateTimeService dateTimeService,
     ILanguageService languageService,
     IWorkContext workContext,
     SeoSettings seoSettings)
 {
     _brandLayoutService      = brandLayoutService;
     _brandService            = brandService;
     _customerService         = customerService;
     _slugService             = slugService;
     _pictureService          = pictureService;
     _translationService      = translationService;
     _discountService         = discountService;
     _customerActivityService = customerActivityService;
     _dateTimeService         = dateTimeService;
     _languageService         = languageService;
     _workContext             = workContext;
     _seoSettings             = seoSettings;
 }
Example #2
0
 public LayoutController(ICategoryLayoutService categoryLayoutService,
                         IBrandLayoutService brandLayoutService,
                         ICollectionLayoutService collectionLayoutService,
                         IProductLayoutService productLayoutService,
                         IPageLayoutService pageLayoutService)
 {
     _categoryLayoutService   = categoryLayoutService;
     _brandLayoutService      = brandLayoutService;
     _collectionLayoutService = collectionLayoutService;
     _productLayoutService    = productLayoutService;
     _pageLayoutService       = pageLayoutService;
 }
 public GetBrandLayoutViewPathHandler(
     IBrandLayoutService brandLayoutService)
 {
     _brandLayoutService = brandLayoutService;
 }
Example #4
0
        public BrandValidator(IEnumerable <IValidatorConsumer <BrandDto> > validators,
                              ITranslationService translationService, IPictureService pictureService, IBrandService brandService, IBrandLayoutService brandLayoutService)
            : base(validators)
        {
            RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("Api.Catalog.Brand.Fields.Name.Required"));
            RuleFor(x => x).MustAsync(async(x, y, context) =>
            {
                if (!string.IsNullOrEmpty(x.PictureId))
                {
                    var picture = await pictureService.GetPictureById(x.PictureId);
                    if (picture == null)
                    {
                        return(false);
                    }
                }
                return(true);
            }).WithMessage(translationService.GetResource("Api.Catalog.Brand.Fields.PictureId.NotExists"));

            RuleFor(x => x).MustAsync(async(x, y, context) =>
            {
                if (!string.IsNullOrEmpty(x.BrandLayoutId))
                {
                    var layout = await brandLayoutService.GetBrandLayoutById(x.BrandLayoutId);
                    if (layout == null)
                    {
                        return(false);
                    }
                }
                return(true);
            }).WithMessage(translationService.GetResource("Api.Catalog.Brand.Fields.BrandLayoutId.NotExists"));

            RuleFor(x => x).MustAsync(async(x, y, context) =>
            {
                if (!string.IsNullOrEmpty(x.Id))
                {
                    var brand = await brandService.GetBrandById(x.Id);
                    if (brand == null)
                    {
                        return(false);
                    }
                }
                return(true);
            }).WithMessage(translationService.GetResource("Api.Catalog.Brand.Fields.Id.NotExists"));
        }