Beispiel #1
0
        public Setup(IServiceProvider serviceProvider, IProductStore productstore)
        {
            InitializeComponent();

            _serviceProvider = serviceProvider;
            _productstore    = productstore;
        }
Beispiel #2
0
        public ProductStoreQuery(IProductStore productRepository)
        {
            Field <ListGraphType <ProductType> >(
                "products",
                resolve: context => productRepository.GetAllProducts()
                );

            Field <ProductType>(
                "product",
                arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "Id", Description = "Product Id"
            }),
                resolve: context =>
            {
                var id = context.GetArgument <int>("id");
                return(productRepository.GetProductById(id));
            }
                );

            Field <ListGraphType <ChildProductType> >(
                "childProducts",
                arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "Id"
            }),
                resolve: context =>
            {
                var id = context.GetArgument <int>("id");
                return(productRepository.GetChildren(id));
            });
        }
        public async Task <Product> UpdateAsync(IProductStore productStore)
        {
            var productEntity         = this.ToStoreEntity();
            var updateProductResponse = await productStore.UpdateProductAsync(productEntity);

            return(updateProductResponse.ToStoreModel());
        }
        public ItemListViewModel(IProductStore repo)
        {
            _products = _repo.GetProducts();

            // Create the command - Command pattern
            CheckAvailabilityCommand = new RelayCommand(OnCheckAvailability);
        }
Beispiel #5
0
 /// <summary>
 /// Populate the product test data
 /// </summary>
 /// <param name="productStore">
 /// The <see cref="IProductStore{TProduct}"/> instance
 /// </param>
 public static async void Seed(this IProductStore <Product> productStore)
 {
     foreach (var product in TestData.Products)
     {
         await productStore.AddAsync(product);
     }
 }
Beispiel #6
0
 public FilesManager(IProductStore ProductStore, ILogger <ProdoctManager> logger, IMapper mapper, IFilesStore photoStore, ITransaction <ShoppingDbContext> transaction)
 {
     _filesStore  = photoStore;
     _logger      = logger;
     _mapper      = mapper;
     _transaction = transaction;
 }
 public MaterialAmountChange(IMaterialStore materialStore, ITaskStore taskStore, IProductStore productStore, MaterialMethods materialMethods)
 {
     _materialStore   = materialStore;
     _taskStore       = taskStore;
     _productStore    = productStore;
     _materialMethods = materialMethods;
 }
 public TaskChangeMaterialUpdate(IMaterialStore materialStore, ITaskStore taskStore, IProductStore productStore, MaterialMethods materialMethods)
 {
     _materialStore   = materialStore;
     _taskStore       = taskStore;
     _productStore    = productStore;
     _materialMethods = materialMethods;
 }
 public EventManager(IMaterialStore materialStore, ITaskStore taskStore, IProductStore productStore, IPlatform platform, MaterialMethods materialMethods, ExtensionExtras functionLib)
 {
     _materialStore   = materialStore;
     _taskStore       = taskStore;
     _productStore    = productStore;
     _platform        = platform;
     _materialMethods = materialMethods;
     _functionLib     = functionLib;
 }
        public async Task <Product> SaveAsync(IProductStore productStore, ProductConfiguration config)
        {
            var productEntity = this.ToEntity();

            productEntity.Id             = Guid.NewGuid().ToString();
            productEntity.Status         = Contracts.Status.Active;
            productEntity.PostDateTime   = DateTime.Now;
            productEntity.ExpirationDate = DateTime.Now.AddDays(config.ExpiryInDays);
            var addProductResponse = await productStore.AddProductAsync(productEntity);

            return(addProductResponse.ToModel());
        }
        public void SetUp()
        {
            var database = DateTime.UtcNow.Ticks.ToString(CultureInfo.InvariantCulture);
            documentStore = new DocumentStore
            {
                Url = serverUrl,
                DefaultDatabase = database
            };
            documentStore.Initialize();

            productStore = new RavenProductStore(serverUrl, database, 32);
        }
Beispiel #12
0
        public void IndexTestMethod()
        {
            //Arrange
            Mock <IProductStore> productstoremock = new Mock <IProductStore>();
            IProductStore        mockedclassobj   = productstoremock.Object;

            productstoremock.Setup(c => c.FindProduct(It.IsAny <int>())).Returns(true);
            ProductController controller = new ProductController(mockedclassobj);

            ViewResult result = (ViewResult)controller.Index();

            Assert.IsTrue((bool)result.Model);
            productstoremock.Verify(c => c.FindProduct(100));
        }
Beispiel #13
0
        public ProductsModule(IProductStore productStore)
            : base("/products")
        {
            Get("/", _ =>
            {
                string productIdsString = Request.Query.productIds;
                var productIds          = ParseProductIdsFromQueryString(productIdsString);
                var products            = productStore.GetProductsByIds(productIds);

                return(Negotiate
                       .WithModel(products)
                       .WithHeader("cache-control", "max-age=86400"));
            });
        }
        public AddItemViewModel(IProductStore repo)
        {
            // Set the repository - Dependency injection
            _repo = repo;

            // Create the command - Command pattern
            AddCommand = new RelayCommand(OnAdd, CanAdd);

            // Set categories
            // Setting both the categories and products like this is not a good idea
            // Here it will perform everything synchronously. Having a lot of products
            // will cause the UI to freeze. I know there is a way to load the data async
            // but I don't have the time to do it..
            _productCategories = _repo.GetProductCategories();
        }
Beispiel #15
0
        public Sales(IServiceProvider serviceProvider, IProductStore productStore, IInvoiceStore invoiceStore, IPromoCalculatorFactory priceCalculator)
        {
            InitializeComponent();
            this.DataContext = this;

            lineItems = new ObservableCollection <LineItem>();
            listLineItems.ItemsSource = lineItems;

            invoice = new Invoice();

            this.serviceProvider = serviceProvider;
            this.productStore    = productStore;
            this.invoiceStore    = invoiceStore;
            this.priceCalculator = priceCalculator;
        }
Beispiel #16
0
        public ProductsPageViewModel(IProductStore productStore, IPageService pageService)
        {
            _productStore = productStore;
            _pageService  = pageService;

            LoadDataCommand      = new Command(async() => await LoadData());
            AddProductCommand    = new Command(async() => await AddProduct());
            SelectProductCommand = new Command <ProductViewModel>(async p => await SelectProduct(p));
            DeleteProductCommand = new Command <ProductViewModel>(async p => await DeleteProduct(p));

            MessagingCenter.Subscribe <ProductsDetailViewModel, Product>
                (this, Events.ProductAdded, OnProductAdded);

            MessagingCenter.Subscribe <ProductsDetailViewModel, Product>
                (this, Events.ProductUpdated, OnProductUpdated);
        }
Beispiel #17
0
 public ProductType(IProductStore productStore, IDataLoaderContextAccessor dataLoaderAccessor)
 {
     Field(t => t.Id).Description("Product Id.");
     Field(t => t.Name).Description("Product Name.");
     Field(t => t.Description);
     Field(t => t.Price);
     Field <ListGraphType <ChildProductType> >(
         "AssociatedProducts",
         resolve: context =>
     {
         var loader =
             dataLoaderAccessor.Context.GetOrAddCollectionBatchLoader <int, ChildProducts>(
                 "GetReviewsByProductId", productStore.GetChildren);
         return(loader.LoadAsync(context.Source.Id));
     });
 }
        public ProductsDetailViewModel(ProductViewModel viewModel, IProductStore productStore, IPageService pageService)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            _pageService  = pageService;
            _productStore = productStore;
            SaveCommand   = new Command(async() => await Save());
            product       = new Product
            {
                Id                  = viewModel.Id,
                Product_Name        = viewModel.ProductName,
                Product_Description = viewModel.ProductDescription,
                Prix                = viewModel.Prix,
            };
        }
Beispiel #19
0
        public void IndexTestMethod()
        {
            //Arrange
            // mocking the missing class.....productstoremock is the class name(say)...
            Mock <IProductStore> productstoremock = new Mock <IProductStore>();

            //mockproductstore is the mocked Object........
            IProductStore mockproductstore = productstoremock.Object;

            //for method implementation of the mocked class i.e. mocking the method FindProduct......
            productstoremock.Setup(c => c.FindProduct(It.IsAny <int>())).Returns(true);

            ProductController controller = new ProductController(mockproductstore);
            ViewResult        result     = (ViewResult)controller.Index();

            Assert.IsTrue((bool)result.Model);

            //For the verification whtr the fn is executed once or not....
            productstoremock.Verify(c => c.FindProduct(100));
        }
Beispiel #20
0
 public ProductService(IProductStore productStore)
 {
     _productStore = productStore;
 }
Beispiel #21
0
 public DeviceRepositoryController(IDeviceRepositoryManager deviceReposistoryManager, IProductStore productStore, UserManager <AppUser> userManager, IAdminLogger logger) : base(userManager, logger)
 {
     _deviceRepositoryManager = deviceReposistoryManager;
     _productStore            = productStore;
 }
 public ProductsController(IProductStore store)
 {
     _store = store;
 }
 public void AddProductStore(IProductStore store)
 {
     _productStores.Add(store);
 }
Beispiel #24
0
 public ProductManager(IProductStore <TProduct> productStore)
 {
     _productStore = productStore;
 }
 public ProductCatalogController(IProductStore productStore) => this.productStore = productStore;
 public ProductTypeController(IProductStore productStore)
 {
     _productStore = this.GetOrThrowArgumentNullException(productStore, "productStore");
 }
Beispiel #27
0
 public ProductController(IProductStore productStore)
 {
     _productStore = productStore;
 }
 private ServiceProvider()
 {
     ProductStore = new ProductStore();
 }
Beispiel #29
0
 public Worker(IBolagetManager bolagetManager, IProductStore productStore, IStoreStore storeStore)
 {
     _bolagetManager = bolagetManager;
     _productStore   = productStore;
     _storeStore     = storeStore;
 }
 public RemoteProductWorkerSimulator()
 {
     _productStore = ServiceProvider.Instance.ProductStore;
 }
Beispiel #31
0
 public MainWindow()
 {
     InitializeComponent();
     _productStore = ServiceProvider.Instance.ProductStore;
 }
 public ProductController(IProductStore productstore)
 {
     this.productstore = productstore;
 }
 public ProductController(IProductStore productStore, IBiopsyStore biopsyStore)
 {
     _productStore = this.GetOrThrowArgumentNullException(productStore, "productStore");
     _biopsyStore = this.GetOrThrowArgumentNullException(biopsyStore, "biopsyStore");
 }