Пример #1
0
 public PagesControllerRouteTests()
 {
     logger = A.Fake <ILogger <PagesController> >();
     fakeJobCategoryPageContentService = A.Fake <IContentPageService <JobCategory> >();
     fakeJobProfilePageContentService  = A.Fake <IContentPageService <JobProfile> >();
     fakeMapper = A.Fake <IMapper>();
 }
Пример #2
0
        public ManageController(
            IUnitOfWorkAsync unitOfWorkAsync,
            ISettingService settingService,
            ICategoryService categoryService,
            IListingService listingService,
            ICustomFieldService customFieldService,
            ICustomFieldCategoryService customFieldCategoryService,
            IContentPageService contentPageService,
            IOrderService orderService,
            ISettingDictionaryService settingDictionaryService,
            IEmailTemplateService emailTemplateService,
            DataCacheService dataCacheService,
            SqlDbService sqlDbService,
            IPluginFinder pluginFinder)
        {
            _settingService           = settingService;
            _settingDictionaryService = settingDictionaryService;

            _categoryService            = categoryService;
            _listingService             = listingService;
            _customFieldService         = customFieldService;
            _customFieldCategoryService = customFieldCategoryService;

            _orderService = orderService;

            _emailTemplateService = emailTemplateService;
            _contentPageService   = contentPageService;
            _unitOfWorkAsync      = unitOfWorkAsync;
            _dataCacheService     = dataCacheService;
            _sqlDbService         = sqlDbService;
            _pluginFinder         = pluginFinder;
        }
Пример #3
0
 public ContentPagesController(IContentPageService contentPageService, IModelMapper modelMapper, IDataSerializer dataSerializer, ISeoMetaService seoMetaService)
 {
     _contentPageService = contentPageService;
     _modelMapper        = modelMapper;
     _dataSerializer     = dataSerializer;
     _seoMetaService     = seoMetaService;
 }
 public PagesController(ILogger <PagesController> logger, IContentPageService <JobCategory> jobCategoryPageContentService, IContentPageService <JobProfile> jobProfilePageContentService, AutoMapper.IMapper mapper)
 {
     this.logger = logger;
     this.jobCategoryPageContentService = jobCategoryPageContentService;
     this.jobProfilePageContentService  = jobProfilePageContentService;
     this.mapper = mapper;
 }
Пример #5
0
 public PagesController(ILogger <PagesController> logger, IContentPageService <ContentPageModel> contentPageService, AutoMapper.IMapper mapper, IPagesControlerHelpers pagesControlerHelpers)
 {
     this.logger                = logger;
     this.contentPageService    = contentPageService;
     this.mapper                = mapper;
     this.pagesControlerHelpers = pagesControlerHelpers;
 }
Пример #6
0
 public DynamicRouteProvider(ISeoMetaService seoMetaService, ICategoryService categoryService, IRouteTemplateParser routeTemplateParser, IContentPageService contentPageService)
 {
     _seoMetaService      = seoMetaService;
     _categoryService     = categoryService;
     _routeTemplateParser = routeTemplateParser;
     _contentPageService  = contentPageService;
 }
Пример #7
0
 public NavigationController(IMenuService menuService, IMenuItemService menuItemService, IModelMapper modelMapper, IContentPageService contentPageService, IProductService productService, ICategoryService categoryService)
 {
     _menuService        = menuService;
     _menuItemService    = menuItemService;
     _modelMapper        = modelMapper;
     _contentPageService = contentPageService;
     _productService     = productService;
     _categoryService    = categoryService;
 }
Пример #8
0
 public HomeController(
     ICategoryService categoryService,
     IListingService listingService,
     IContentPageService contentPageService)
 {
     _categoryService    = categoryService;
     _listingService     = listingService;
     _contentPageService = contentPageService;
 }
Пример #9
0
        public HomeController(
            ICategoryService categoryService,
            IListingService listingService,
            IContentPageService contentPageService)
        {
            _categoryService = categoryService;
            _listingService = listingService;
            _contentPageService = contentPageService;

        }
Пример #10
0
        public HomeController(
            ICategoryService categoryService,
            IItemService itemService,
            IContentPageService contentPageService)
        {
            _categoryService = categoryService;
            _itemService = itemService;
            _contentPageService = contentPageService;

        }
Пример #11
0
 public NavigationController(IMenuService menuService, IMenuItemService menuItemService, IModelMapper modelMapper, IContentPageService contentPageService, IProductService productService, ICategoryService categoryService, ICategoryAccountant categoryAccountant, IDataSerializer dataSerializer)
 {
     _menuService        = menuService;
     _menuItemService    = menuItemService;
     _modelMapper        = modelMapper;
     _contentPageService = contentPageService;
     _productService     = productService;
     _categoryService    = categoryService;
     _categoryAccountant = categoryAccountant;
     _dataSerializer     = dataSerializer;
 }
Пример #12
0
        public ListingController(
            IUnitOfWorkAsync unitOfWorkAsync,
            ISettingService settingService,
            ICategoryService categoryService,
            ICategoryListingTypeService categoryListingTypeService,
            IListingService listingService,
            IListingTypeService listingTypeService,
            ICustomFieldService customFieldService,
            ICustomFieldCategoryService customFieldCategoryService,
            ICustomFieldListingService customFieldListingService,
            IContentPageService contentPageService,
            IOrderService orderService,
            IDetailBedService detailBedService,
            ITypeOfBedService typeOfBedService,
            ISettingDictionaryService settingDictionaryService,
            IEmailTemplateService emailTemplateService,
            IPictureService pictureService,
            IListingPictureService listingPictureservice,
            IListingReviewService listingReviewService,
            DataCacheService dataCacheService,
            SqlDbService sqlDbService,
            AspNetUserService aspNetUserService,
            IListingObservationService listingObservationService)
        {
            _settingService           = settingService;
            _settingDictionaryService = settingDictionaryService;

            _categoryService            = categoryService;
            _categoryListingTypeService = categoryListingTypeService;

            _listingService     = listingService;
            _listingTypeService = listingTypeService;

            _pictureService = pictureService;

            _listingPictureservice = listingPictureservice;
            _listingReviewService  = listingReviewService;

            _customFieldService         = customFieldService;
            _customFieldCategoryService = customFieldCategoryService;
            _customFieldListingService  = customFieldListingService;

            _orderService = orderService;

            _emailTemplateService      = emailTemplateService;
            _contentPageService        = contentPageService;
            _unitOfWorkAsync           = unitOfWorkAsync;
            _dataCacheService          = dataCacheService;
            _detailBedService          = detailBedService;
            _typeOfBedService          = typeOfBedService;
            _sqlDbService              = sqlDbService;
            _aspNetUserService         = aspNetUserService;
            _listingObservationService = listingObservationService;
        }
Пример #13
0
 public HomeController(
     ICategoryService categoryService,
     IListingService listingService,
     IContentPageService contentPageService,
     IContentPageRoleService contentPageRoleService,
     ICustomFieldCategoryService customFieldCategoryService,
     IMetaFieldService metaFieldService)
 {
     _categoryService            = categoryService;
     _listingService             = listingService;
     _contentPageService         = contentPageService;
     _contentPageRoleService     = contentPageRoleService;
     _customFieldCategoryService = customFieldCategoryService;
     _metaFieldService           = metaFieldService;
 }
Пример #14
0
 public ContentController(IMasterContentService masterContentService, ICategoryService categoryService,
                          IRecipeService recipeService, IFAQService faqService, IArticleService articleService, IContentPageService contentPageService,
                          IEmailTemplateService emailTemplateService, ILoggerFactory loggerProvider,
                          IContentCrossSellService contentCrossSellService, IProductService productService, ExtendedUserManager userManager)
 {
     this.masterContentService    = masterContentService;
     this.categoryService         = categoryService;
     this.recipeService           = recipeService;
     this.faqService              = faqService;
     this.articleService          = articleService;
     this.contentPageService      = contentPageService;
     this.emailTemplateService    = emailTemplateService;
     this.contentCrossSellService = contentCrossSellService;
     this.productService          = productService;
     _userManager = userManager;
     this.logger  = loggerProvider.CreateLogger <ContentController>();
 }
Пример #15
0
        public ListingController(
            IUnitOfWorkAsync unitOfWorkAsync,
            ISettingService settingService,
            ICategoryService categoryService,
            ICategoryListingTypeService categoryListingTypeService,
            IListingService listingService,
            IListingTypeService ListingTypeService,
            ICustomFieldService customFieldService,
            ICustomFieldCategoryService customFieldCategoryService,
            ICustomFieldListingService customFieldListingService,
            IContentPageService contentPageService,
            IOrderService orderService,
            ISettingDictionaryService settingDictionaryService,
            IEmailTemplateService emailTemplateService,
            IPictureService pictureService,
            IListingPictureService ListingPictureservice,
            DataCacheService dataCacheService,
            SqlDbService sqlDbService)
        {
            _settingService           = settingService;
            _settingDictionaryService = settingDictionaryService;

            _categoryService            = categoryService;
            _categoryListingTypeService = categoryListingTypeService;

            _listingService     = listingService;
            _ListingTypeService = ListingTypeService;

            _pictureService        = pictureService;
            _ListingPictureservice = ListingPictureservice;

            _customFieldService         = customFieldService;
            _customFieldCategoryService = customFieldCategoryService;
            _customFieldListingService  = customFieldListingService;

            _orderService = orderService;

            _emailTemplateService = emailTemplateService;
            _contentPageService   = contentPageService;
            _unitOfWorkAsync      = unitOfWorkAsync;
            _dataCacheService     = dataCacheService;
            _sqlDbService         = sqlDbService;
        }
Пример #16
0
        public PageTypeServices(
            IMenuService menuPageRepository,
            IStartPageService startPageRepository,
            ISiteSettingsService siteSettingsPageRepository,
            IContentPageService contentPageService,
            IKeyValueService keyValueRepository)
        {
            Guard.ValidateObject(menuPageRepository);
            Guard.ValidateObject(startPageRepository);
            Guard.ValidateObject(keyValueRepository);
            Guard.ValidateObject(siteSettingsPageRepository);
            Guard.ValidateObject(contentPageService);

            MenuService         = menuPageRepository;
            StartPageService    = startPageRepository;
            KeyValueService     = keyValueRepository;
            SiteSettingsService = siteSettingsPageRepository;
            ContentPageService  = contentPageService;
        }
Пример #17
0
 public WebhookContentProcessor(
     ILogger <WebhookContentProcessor> logger,
     AutoMapper.IMapper mapper,
     IEventMessageService <ContentPageModel> eventMessageService,
     ICmsApiService cmsApiService,
     IContentPageService <ContentPageModel> contentPageService,
     IContentCacheService contentCacheService,
     IEventGridService eventGridService,
     IPageLocatonUpdater pageLocatonUpdater,
     IContentItemUpdater contentItemUpdater)
 {
     this.logger = logger;
     this.mapper = mapper;
     this.eventMessageService = eventMessageService;
     this.cmsApiService       = cmsApiService;
     this.contentPageService  = contentPageService;
     this.contentCacheService = contentCacheService;
     this.eventGridService    = eventGridService;
     this.pageLocatonUpdater  = pageLocatonUpdater;
     this.contentItemUpdater  = contentItemUpdater;
 }
 public static IWebHostBuilder RegisterServices(
     this IWebHostBuilder webHostBuilder, ICosmosRepository <ContentPageModel> cosmosRepository, IContentPageService <ContentPageModel> contentPageService)
 {
     return(webHostBuilder.ConfigureTestServices(services =>
     {
         services.AddTransient(sp => cosmosRepository);
         services.AddTransient(sp => contentPageService);
         services.AddTransient <IPagesControlerHelpers, FakePagesControlerHelpers>();
         services.AddTransient <ISubscriptionRegistrationService, FakeSubscriptionRegistrationService>();
         services.AddTransient <IWebhooksService, FakeWebhooksService>();
     }));
 }
Пример #19
0
        public ManageController(
            IUnitOfWorkAsync unitOfWorkAsync,
            ISettingService settingService,
            ICategoryService categoryService,
            IListingService listingService,
            ICustomFieldService customFieldService,
            ICustomFieldCategoryService customFieldCategoryService,
            IContentPageService contentPageService,
            IOrderService orderService,
            ISettingDictionaryService settingDictionaryService,
            IEmailTemplateService emailTemplateService,
            DataCacheService dataCacheService,
            SqlDbService sqlDbService,
            IPluginFinder pluginFinder)
        {
            _settingService = settingService;
            _settingDictionaryService = settingDictionaryService;

            _categoryService = categoryService;
            _listingService = listingService;
            _customFieldService = customFieldService;
            _customFieldCategoryService = customFieldCategoryService;

            _orderService = orderService;

            _emailTemplateService = emailTemplateService;
            _contentPageService = contentPageService;
            _unitOfWorkAsync = unitOfWorkAsync;
            _dataCacheService = dataCacheService;
            _sqlDbService = sqlDbService;
            _pluginFinder = pluginFinder;
        }
        public PaymentController(
            IUnitOfWorkAsync unitOfWorkAsync,
            ISettingService settingService,
            ICategoryService categoryService,
            IItemService itemService,
            ICustomFieldService customFieldService,
            ICustomFieldCategoryService customFieldCategoryService,
            IContentPageService contentPageService,
            IOrderService orderService,
            IOrderTransactionService orderTransationService,
            IStripeConnectService stripConnectService,
            ISettingDictionaryService settingDictionaryService,
            IEmailTemplateService emailTemplateService,
            DataCacheService dataCacheService,
            SqlDbService sqlDbService)
        {
            _settingService = settingService;
            _settingDictionaryService = settingDictionaryService;

            _categoryService = categoryService;
            _itemService = itemService;
            _customFieldService = customFieldService;
            _customFieldCategoryService = customFieldCategoryService;

            _orderService = orderService;
            _stripConnectService = stripConnectService;
            _orderTransactionService = orderTransationService;

            _emailTemplateService = emailTemplateService;
            _contentPageService = contentPageService;
            _unitOfWorkAsync = unitOfWorkAsync;
            _dataCacheService = dataCacheService;
            _sqlDbService = sqlDbService;
        }
Пример #21
0
 public PagesControlerHelpers(IContentPageService <ContentPageModel> contentPageService, IMemoryCache memoryCache)
 {
     this.contentPageService = contentPageService;
     this.memoryCache        = memoryCache;
 }
        public ContentPageGraphType(
            IDataLoaderContextAccessor dataLoaderContextAccessor,
            IMetaFieldServiceProvider metaFieldServiceProvider,
            IMetaFieldService metaFieldService,
            IMetaFieldLookupService metaFieldLookupService,
            IContentPageService contentPageService,
            IContentPageLookupService contentPageLookupService
            )
        {
            Name = "ContentPage";

            Field <StringGraphType, string>()
            .Name("Id")
            .Description("Globally unique identifier, eg: gid://ContentPage/1000")
            .Resolve(ctx => ctx.Source.Id);

            Field <StringGraphType, string>()
            .Name("ParentId")
            .Description("Globally unique identifier of parent, 'gid://' if none")
            .Resolve(ctx => ctx.Source.ParentId);

            Field <StringGraphType, string>()
            .Name("Handle")
            .Description("A human-friendly unique string for the content page")
            .Resolve(ctx =>
            {
                var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                return(ctx.Source.Handles
                       .FirstOrDefault(x => x.LanguageCode == userContext.LanguageCode)
                       ?.Value);
            });

            Field <StringGraphType, string>()
            .Name("Title")
            .Description("The title of the content page")
            .Resolve(ctx =>
            {
                var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                return(ctx.Source.Titles
                       .FirstOrDefault(x => x.LanguageCode == userContext.LanguageCode)
                       ?.Value);
            });

            Field <StringGraphType, string>()
            .Name("Url")
            .Description("The url of the content page")
            .Resolve(ctx =>
            {
                var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                return(ctx.Source.Urls
                       .FirstOrDefault(x => x.LanguageCode == userContext.LanguageCode)
                       ?.Value);
            });

            Field <StringGraphType, string>()
            .Name("Type")
            .Description("The type of the content page")
            .Resolve(ctx => ctx.Source.Type);

            Field <StringGraphType, string>()
            .Name("Description")
            .Description("The description of the content page")
            .Resolve(ctx =>
            {
                var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                return(ctx.Source.Descriptions
                       .FirstOrDefault(x => x.LanguageCode == userContext.LanguageCode)
                       ?.Value);
            });

            Field <DateTimeGraphType, DateTime>()
            .Name("CreatedAt")
            .Description("The timestamp of content page creation")
            .Resolve(ctx => ctx.Source.CreatedAt.ToDateTime());

            Field <DateTimeGraphType, DateTime>()
            .Name("UpdatedAt")
            .Description("The timestamp of the latest content page update")
            .Resolve(ctx => ctx.Source.UpdatedAt.ToDateTime());

            Field <ImageGraphType, Image>()
            .Name("PrimaryImage")
            .Description("The primary image of the content page")
            .Resolve(ctx => ctx.Source.PrimaryImage);

            #region Meta-fields

            Field <MetaFieldGraphType, MetaField>()
            .Name("MetaField")
            .Description("Connection to a specific meta-field")
            .Argument <NonNullGraphType <StringGraphType> >("namespace", "Namespace of the meta-field")
            .Argument <NonNullGraphType <StringGraphType> >("name", "Name of the meta-field")
            .ResolveAsync(async ctx =>
            {
                if (!metaFieldServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Meta-fields not supported.");
                }

                var result = await metaFieldService.GetBySearchAsync(
                    ctx.Source.Id,
                    ctx.GetArgument <string>("namespace"),
                    ctx.GetArgument <string>("name"));

                return(result.FirstOrDefault());
            });

            Field <ListGraphType <MetaFieldGraphType>, IList <MetaField> >()
            .Name("MetaFields")
            .Description("Connection to a all meta-fields")
            .ResolveAsync(ctx =>
            {
                if (!metaFieldServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Meta-fields not supported.");
                }

                var loader = dataLoaderContextAccessor.Context
                             .GetOrAddBatchLoader <string, IList <MetaField> >("MetaField.LookupByParentIdsAsync", metaFieldLookupService.LookupByParentIdsAsync);
                return(loader.LoadAsync(ctx.Source.Id));
            });

            #endregion Meta-fields

            #region Content pages

            Field <ContentPageGraphType, ContentPage>()
            .Name("Parent")
            .ResolveAsync(ctx =>
            {
                if (string.IsNullOrEmpty(ctx.Source.ParentId))
                {
                    return(null);
                }

                var loader = dataLoaderContextAccessor.Context
                             .GetOrAddBatchLoader <string, ContentPage>("ContentPage.LookupByIdAsync", contentPageLookupService.LookupByIdAsync);
                return(loader.LoadAsync(ctx.Source.ParentId));
            });
            Connection <ContentPageGraphType>()
            .Name("Children")
            .Unidirectional()
            .Argument <StringGraphType>("query", "The search query to filter children by")
            .Argument <ContentPageSortKeyGraphType>("sortKey", "The key to sort the underlying list by")
            .Argument <StringGraphType>("reverse", "Reverse the order of the underlying list")
            .ResolveAsync(async ctx =>
            {
                var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                var result = await contentPageService.GetBySearchAsync(
                    ctx.GetArgument <string>("query"),
                    userContext.LanguageCode,
                    ctx.Source.Id,
                    ctx.GetArgument <string>("after"),
                    ctx.GetArgument <int>("first", 24),
                    ctx.GetArgument <ContentPageSortKey>("sortKey"),
                    ctx.GetArgument <bool>("reverse"));

                return(result.ToGraphConnection());
            });

            #endregion Content pages
        }
Пример #23
0
 public ContentPageLookupService(
     IContentPageService contentPageService)
 {
     _contentPageService = contentPageService;
 }
Пример #24
0
 public EventMessageService(ILogger <EventMessageService <TModel> > logger, IContentPageService <TModel> contentPageService)
 {
     this.logger             = logger;
     this.contentPageService = contentPageService;
 }
Пример #25
0
 public ContentPageServiceGetByNameTests()
 {
     repository         = A.Fake <ICosmosRepository <TestContentPageModel> >();
     contentPageService = new ContentPageService <TestContentPageModel>(repository);
 }
Пример #26
0
 public SitemapController(ILogger <SitemapController> logger, IContentPageService contentPageService)
 {
     this.logger             = logger;
     this.contentPageService = contentPageService;
 }
 public PagesControlerHelpers(IContentPageService <ContentPageModel> contentPageService)
 {
     this.contentPageService = contentPageService;
 }
Пример #28
0
 public HealthController(ILogger <HealthController> logger, IContentPageService <JobCategory> contentPageService)
 {
     this.logger             = logger;
     this.contentPageService = contentPageService;
 }
Пример #29
0
 public PagesController(ILogger <PagesController> logger, IContentPageService contentPageService, AutoMapper.IMapper mapper)
 {
     this.logger             = logger;
     this.contentPageService = contentPageService;
     this.mapper             = mapper;
 }
        public StorefrontGraphQuery(
            IDataLoaderContextAccessor dataLoaderContextAccessor,
            ILanguageProvider languageProvider,
            ICurrencyProvider currencyProvider,
            IContentPageServiceProvider contentPageServiceProvider,
            INavigationServiceProvider navigationServiceProvider,
            ICategoryServiceProvider categoryServiceProvider,
            IProductServiceProvider productServiceProvider,
            IContentPageService contentPageService,
            IContentPageLookupService contentPageLookupService,
            INavigationLookupService navigationLookupService,
            ICategoryService categoryService,
            ICategoryLookupService categoryLookupService,
            IProductService productService,
            IProductLookupService productLookupService)
        {
            Name = "Query";

            #region Languages

            Field <ListGraphType <LanguageGraphType>, IList <string> >()
            .Name("Languages")
            .Description("The languages supported")
            .Resolve(ctx => languageProvider.Languages);

            #endregion Languages

            #region Currencies

            Field <ListGraphType <CurrencyGraphType>, IList <NodaMoney.Currency> >()
            .Name("Currencies")
            .Description("The currencies supported")
            .Resolve(ctx => currencyProvider.Currencies
                     .Select(NodaMoney.Currency.FromCode)
                     .ToList());

            #endregion Currencies

            #region Content Pages

            Field <ContentPageGraphType, ContentPage>()
            .Name("ContentPage")
            .Argument <StringGraphType>("id", "Id of the content page")
            .Argument <StringGraphType>("handle", "Handle of the content page")
            .ResolveAsync(ctx =>
            {
                if (!contentPageServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Content pages not supported.");
                }

                if (ctx.HasArgument("id"))
                {
                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, ContentPage>("ContentPage.LookupByIdAsync", contentPageLookupService.LookupByIdAsync);
                    return(loader.LoadAsync(ctx.GetArgument <string>("id")));
                }

                if (ctx.HasArgument("handle"))
                {
                    var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, ContentPage>("ContentPage.LookupByHandleAsync", handles =>
                                                                            contentPageLookupService.LookupByHandleAsync(handles, userContext.LanguageCode));
                    return(loader.LoadAsync(ctx.GetArgument <string>("handle")));
                }

                return(null);
            });

            Connection <ContentPageGraphType>()
            .Name("ContentPages")
            .Unidirectional()
            .Argument <StringGraphType>("query", "The search query to filter results by")
            .Argument <ContentPageSortKeyGraphType>("sortKey", "The key to sort the underlying list by")
            .Argument <StringGraphType>("reverse", "Reverse the order of the underlying list")
            .ResolveAsync(async ctx =>
            {
                if (!contentPageServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Content pages not supported.");
                }

                var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                var result = await contentPageService.GetBySearchAsync(
                    ctx.GetArgument <string>("query"),
                    userContext.LanguageCode,
                    null,
                    ctx.GetArgument <string>("after"),
                    ctx.GetArgument <int>("first", 24),
                    ctx.GetArgument <ContentPageSortKey>("sortKey"),
                    ctx.GetArgument <bool>("reverse"));

                return(result.ToGraphConnection());
            });

            #endregion Content Pages

            #region Navigations

            Field <NavigationGraphType, Navigation>()
            .Name("Navigation")
            .Argument <StringGraphType>("id", "Id of the navigation")
            .Argument <StringGraphType>("handle", "Handle of the navigation")
            .ResolveAsync(ctx =>
            {
                if (!navigationServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Navigations not supported.");
                }

                if (ctx.HasArgument("id"))
                {
                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, Navigation>("Navigation.LookupByIdAsync", navigationLookupService.LookupByIdAsync);
                    return(loader.LoadAsync(ctx.GetArgument <string>("id")));
                }

                if (ctx.HasArgument("handle"))
                {
                    var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, Navigation>("Navigation.LookupByHandleAsync", handles =>
                                                                           navigationLookupService.LookupByHandleAsync(handles, userContext.LanguageCode));
                    return(loader.LoadAsync(ctx.GetArgument <string>("handle")));
                }

                return(null);
            });

            #endregion Navigations

            #region Categories

            Field <CategoryGraphType, Category>()
            .Name("Category")
            .Argument <StringGraphType>("id", "Id of the category")
            .Argument <StringGraphType>("handle", "Handle of the category")
            .ResolveAsync(ctx =>
            {
                if (!categoryServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Categories not supported.");
                }

                if (ctx.HasArgument("id"))
                {
                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, Category>("Category.LookupByIdAsync", categoryLookupService.LookupByIdAsync);
                    return(loader.LoadAsync(ctx.GetArgument <string>("id")));
                }

                if (ctx.HasArgument("handle"))
                {
                    var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, Category>("Category.LookupByHandleAsync", handles =>
                                                                         categoryLookupService.LookupByHandleAsync(handles, userContext.LanguageCode));
                    return(loader.LoadAsync(ctx.GetArgument <string>("handle")));
                }

                return(null);
            });

            Connection <CategoryGraphType>()
            .Name("Categories")
            .Unidirectional()
            .Argument <StringGraphType>("query", "The search query to filter results by")
            .Argument <CategorySortKeyGraphType>("sortKey", "The key to sort the underlying list by")
            .Argument <StringGraphType>("reverse", "Reverse the order of the underlying list")
            .ResolveAsync(async ctx =>
            {
                if (!categoryServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Categories not supported.");
                }

                var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                var result = await categoryService.GetBySearchAsync(
                    ctx.GetArgument <string>("query"),
                    userContext.LanguageCode,
                    null,
                    ctx.GetArgument <string>("after"),
                    ctx.GetArgument <int>("first", 24),
                    ctx.GetArgument <CategorySortKey>("sortKey"),
                    ctx.GetArgument <bool>("reverse"));

                return(result.ToGraphConnection());
            });

            #endregion Categories

            #region Products

            Field <ProductGraphType, Product>()
            .Name("Product")
            .Argument <StringGraphType>("id", "Id of the category")
            .Argument <StringGraphType>("handle", "Handle of the category")
            .ResolveAsync(ctx =>
            {
                if (!productServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Products not supported.");
                }

                if (ctx.HasArgument("id"))
                {
                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, Product>("Product.LookupByIdAsync", productLookupService.LookupByIdAsync);
                    return(loader.LoadAsync(ctx.GetArgument <string>("id")));
                }

                if (ctx.HasArgument("handle"))
                {
                    var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                    var loader = dataLoaderContextAccessor.Context
                                 .GetOrAddBatchLoader <string, Product>("Product.LookupByHandleAsync", handles =>
                                                                        productLookupService.LookupByHandleAsync(handles, userContext.LanguageCode));
                    return(loader.LoadAsync(ctx.GetArgument <string>("handle")));
                }

                return(null);
            });

            Connection <ProductGraphType>()
            .Name("Products")
            .Unidirectional()
            .Argument <StringGraphType>("query", "The search query to filter results by")
            .Argument <ProductSortKeyGraphType>("sortKey", "The key to sort the underlying list by")
            .Argument <StringGraphType>("reverse", "Reverse the order of the underlying list")
            .ResolveAsync(async ctx =>
            {
                if (!productServiceProvider.IsEnabled)
                {
                    throw new ExecutionError("Products not supported.");
                }

                var userContext = (StorefrontGraphUserContext)ctx.UserContext;

                var result = await productService.GetBySearchAsync(
                    ctx.GetArgument <string>("query"),
                    userContext.LanguageCode,
                    null,
                    ctx.GetArgument <string>("after"),
                    ctx.GetArgument <int>("first", 24),
                    ctx.GetArgument <ProductSortKey>("sortKey"),
                    ctx.GetArgument <bool>("reverse"),
                    userContext.CurrencyCode);

                return(result.ToGraphConnection());
            });

            #endregion Products
        }
Пример #31
0
 public ContentPagesController(IContentPageService contentPageService, IModelMapper modelMapper)
 {
     _contentPageService = contentPageService;
     _modelMapper        = modelMapper;
 }
 public ContentPageServiceGetByNameTests()
 {
     repository         = A.Fake <ICosmosRepository <JobCategory> >();
     contentPageService = new ContentPageService <JobCategory>(repository);
 }
Пример #33
0
 public HealthController(ILogger <HealthController> logger, IContentPageService <ContentPageModel> contentPageService)
 {
     this.logger             = logger;
     this.contentPageService = contentPageService;
 }
 public ApiController(ILogger <ApiController> logger, IContentPageService <ContentPageModel> contentPageService, IMapper mapper)
 {
     this.logger             = logger;
     this.contentPageService = contentPageService;
     this.mapper             = mapper;
 }
Пример #35
0
        public ListingController(
            IUnitOfWorkAsync unitOfWorkAsync,
            ISettingService settingService,
            ICategoryService categoryService,
            ICategoryListingTypeService categoryListingTypeService,
            IListingService listingService,
            IListingTypeService ListingTypeService,
            ICustomFieldService customFieldService,
            ICustomFieldCategoryService customFieldCategoryService,
            ICustomFieldListingService customFieldListingService,
            IContentPageService contentPageService,
            IOrderService orderService,
            ISettingDictionaryService settingDictionaryService,
            IEmailTemplateService emailTemplateService,
            IPictureService pictureService,
            IListingPictureService ListingPictureservice,
            DataCacheService dataCacheService,
            SqlDbService sqlDbService)
        {
            _settingService = settingService;
            _settingDictionaryService = settingDictionaryService;

            _categoryService = categoryService;
            _categoryListingTypeService = categoryListingTypeService;

            _listingService = listingService;
            _ListingTypeService = ListingTypeService;

            _pictureService = pictureService;
            _ListingPictureservice = ListingPictureservice;

            _customFieldService = customFieldService;
            _customFieldCategoryService = customFieldCategoryService;
            _customFieldListingService = customFieldListingService;

            _orderService = orderService;

            _emailTemplateService = emailTemplateService;
            _contentPageService = contentPageService;
            _unitOfWorkAsync = unitOfWorkAsync;
            _dataCacheService = dataCacheService;
            _sqlDbService = sqlDbService;
        }