public LayoutController(ICategoryLayoutService categoryLayoutService,
                         IBrandLayoutService brandLayoutService,
                         ICollectionLayoutService collectionLayoutService,
                         IProductLayoutService productLayoutService,
                         IPageLayoutService pageLayoutService)
 {
     _categoryLayoutService   = categoryLayoutService;
     _brandLayoutService      = brandLayoutService;
     _collectionLayoutService = collectionLayoutService;
     _productLayoutService    = productLayoutService;
     _pageLayoutService       = pageLayoutService;
 }
Beispiel #2
0
 public CategoryViewModelService(ICategoryService categoryService, IProductCategoryService productCategoryService, ICategoryLayoutService categoryLayoutService, IDiscountService discountService,
                                 ITranslationService translationService, IStoreService storeService, ICustomerService customerService, IGroupService groupService, IPictureService pictureService,
                                 ISlugService slugService, ICustomerActivityService customerActivityService, IProductService productService,
                                 IVendorService vendorService, IDateTimeService dateTimeService, ILanguageService languageService, CatalogSettings catalogSettings, SeoSettings seoSettings)
 {
     _categoryService         = categoryService;
     _productCategoryService  = productCategoryService;
     _categoryLayoutService   = categoryLayoutService;
     _discountService         = discountService;
     _translationService      = translationService;
     _storeService            = storeService;
     _customerService         = customerService;
     _groupService            = groupService;
     _slugService             = slugService;
     _customerActivityService = customerActivityService;
     _productService          = productService;
     _pictureService          = pictureService;
     _vendorService           = vendorService;
     _languageService         = languageService;
     _catalogSettings         = catalogSettings;
     _dateTimeService         = dateTimeService;
     _seoSettings             = seoSettings;
 }
        public CategoryValidator(IEnumerable <IValidatorConsumer <CategoryDto> > validators,
                                 ITranslationService translationService, IPictureService pictureService, ICategoryService categoryService, ICategoryLayoutService
                                 categoryLayoutService) : base(validators)
        {
            RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("Api.Catalog.Category.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.Category.Fields.PictureId.NotExists"));

            RuleFor(x => x).MustAsync(async(x, y, context) =>
            {
                if (!string.IsNullOrEmpty(x.ParentCategoryId))
                {
                    var category = await categoryService.GetCategoryById(x.ParentCategoryId);
                    if (category == null)
                    {
                        return(false);
                    }
                }
                return(true);
            }).WithMessage(translationService.GetResource("Api.Catalog.Category.Fields.ParentCategoryId.NotExists"));

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

            RuleFor(x => x).MustAsync(async(x, y, context) =>
            {
                if (!string.IsNullOrEmpty(x.Id))
                {
                    var category = await categoryService.GetCategoryById(x.Id);
                    if (category == null)
                    {
                        return(false);
                    }
                }
                return(true);
            }).WithMessage(translationService.GetResource("Api.Catalog.Category.Fields.Id.NotExists"));
        }
Beispiel #4
0
 public GetCategoryLayoutViewPathHandler(
     ICategoryLayoutService categoryLayoutService)
 {
     _categoryLayoutService = categoryLayoutService;
 }