Exemplo n.º 1
0
 public CartHubService(IAccessTokenProvider tokenProvider,
                       IConfiguration configuration,
                       ICartDataService dataServiceBase,
                       IMapper mapper,
                       IToastService toastService) : base(tokenProvider, configuration, dataServiceBase, mapper)
 {
     _toastService = toastService;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance for the <see cref="CatalogPageViewModel" /> class.
        /// </summary>
        public CatalogPageViewModel(ICatalogDataService catalogDataService, ICartDataService cartDataService,
                                    IWishlistDataService wishlistDataService, string selectedCategory)
        {
            this.catalogDataService  = catalogDataService;
            this.cartDataService     = cartDataService;
            this.wishlistDataService = wishlistDataService;

            Device.BeginInvokeOnMainThread(() =>
            {
                UpdateCartItemCount();
                FetchProducts(selectedCategory);
            });
        }
        /// <summary>
        /// Initializes a new instance for the <see cref="CheckoutPageViewModel" /> class.
        /// </summary>
        public CheckoutPageViewModel(IUserDataService userDataService, ICartDataService cartDataService,
                                     ICatalogDataService catalogDataService, IMyOrdersDataService myOrdersDataService = null)
        {
            this.userDataService    = userDataService;
            this.cartDataService    = cartDataService;
            this.catalogDataService = catalogDataService;
            DeliveryAddress         = new ObservableCollection <Customer>();
            PaymentModes            = new ObservableCollection <Payment>();

            Device.BeginInvokeOnMainThread(() =>
            {
                FetchAddresses();
                FetchPaymentOptions();
                FetchCartList();
            });

            EditCommand          = new DelegateCommand(EditClicked);
            AddAddressCommand    = new DelegateCommand(AddAddressClicked);
            PlaceOrderCommand    = new DelegateCommand(PlaceOrderClicked);
            PaymentOptionCommand = new DelegateCommand(PaymentOptionClicked);
            ApplyCouponCommand   = new DelegateCommand(ApplyCouponClicked);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance for the <see cref="DetailPageViewModel" /> class.
        /// </summary>
        public DetailPageViewModel(ICatalogDataService catalogDataService, ICartDataService cartDataService,
                                   IWishlistDataService wishlistDataService, Product selectedProduct)
        {
            this.catalogDataService  = catalogDataService;
            this.cartDataService     = cartDataService;
            this.wishlistDataService = wishlistDataService;
            this.selectedProduct     = selectedProduct;

            Device.BeginInvokeOnMainThread(() =>
            {
                AddRecentProduct(selectedProduct.ID.ToString());
                FetchProduct(selectedProduct.ID.ToString());
                UpdateCartItemCount();
            });

            AddFavouriteCommand = new DelegateCommand(AddFavouriteClicked);
            NotificationCommand = new DelegateCommand(NotificationClicked);
            AddToCartCommand    = new DelegateCommand(AddToCartClicked);
            LoadMoreCommand     = new DelegateCommand(LoadMoreClicked);
            ShareCommand        = new DelegateCommand(ShareClicked);
            VariantCommand      = new DelegateCommand(VariantClicked);
            CardItemCommand     = new DelegateCommand(CartClicked);
            BackButtonCommand   = new DelegateCommand(BackButtonClicked);
        }
Exemplo n.º 5
0
 public CartDbService(ICartDataService cartDataService, IContextFactory contextFactory, ILogger <CartDbService> logger, IMapper mapper) : base(cartDataService, contextFactory, logger, mapper)
 {
 }
Exemplo n.º 6
0
 public CartController(ICartDataService CartService) => cartService = CartService;
Exemplo n.º 7
0
        public void TestInitialize()
        {
            cart = new Cart
            {
                Items = new List <CartItem>
                {
                    new CartItem {
                        ProductId = 1, Quantity = 1
                    },
                    new CartItem {
                        ProductId = 2, Quantity = 3
                    }
                }
            };
            productDataMock = new Mock <IProductDataService>();
            productDataMock
            .Setup(c => c.GetProducts(It.IsAny <ProductFilter>()))
            .Returns(new PageProductsDTO
            {
                Products = new List <ProductDTO> {
                    new ProductDTO
                    {
                        Id       = 1,
                        Name     = "Product 1",
                        Price    = 1.1m,
                        Order    = 0,
                        ImageUrl = "Product1.png",
                        Brand    = new BrandDTO {
                            Id = 1, Name = "Brand 1"
                        },
                        Section = new SectionDTO {
                            Id = 1, Name = "Section 1"
                        }
                    },
                    new ProductDTO
                    {
                        Id       = 2,
                        Name     = "Product 2",
                        Price    = 2.2m,
                        Order    = 1,
                        ImageUrl = "Product2.png",
                        Brand    = new BrandDTO {
                            Id = 2, Name = "Brand 2"
                        },
                        Section = new SectionDTO {
                            Id = 2, Name = "Section 2"
                        }
                    }
                },
                TotalCount = 2
            });

            mapperMock = new Mock <IMapper>();
            mapperMock.Setup(mapper => mapper.Map <ProductViewModel>(It.IsAny <ProductDTO>()))
            .Returns <ProductDTO>(p => new ProductViewModel
            {
                Id       = p.Id,
                Name     = p.Name,
                Order    = p.Order,
                Price    = p.Price,
                Brand    = p.Brand?.Name,
                ImageUrl = p.ImageUrl
            });

            cartStoreMock = new Mock <ICartRepo>();
            cartStoreMock.Setup(c => c.Cart).Returns(cart);
            cartService = new CartDataService(productDataMock.Object, cartStoreMock.Object, mapperMock.Object);
        }
Exemplo n.º 8
0
 public CartViewComponent(ICartDataService cartService) => this.cartService = cartService;
 /// <summary>
 /// Initializes a new instance for the <see cref="CartPageViewModel" /> class.
 /// </summary>
 public CartPageViewModel(ICartDataService cartDataService)
 {
     this.cartDataService = cartDataService;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance for the <see cref="CartPageViewModel" /> class.
 /// </summary>
 public CartPageViewModel(string callerPage, ICartDataService cartDataService)
 {
     this.cartDataService = cartDataService;
     MessagingCenter.Subscribe <RecorderViewModel, PredictionData>(this, callerPage, MessageCenterSubmitAsync);
 }
        /// <summary>
        /// Initializes a new instance for the <see cref="CheckoutPageViewModel" /> class.
        /// </summary>
        public CheckoutPageViewModel(string callerPage, IUserDataService userDataService, ICartDataService cartDataService,
                                     ICatalogDataService catalogDataService, IMyOrdersDataService myOrdersDataService = null)
        {
            this.userDataService    = userDataService;
            this.cartDataService    = cartDataService;
            this.catalogDataService = catalogDataService;
            DeliveryAddress         = new ObservableCollection <Customer>();
            PaymentModes            = new ObservableCollection <Payment>();

            Device.BeginInvokeOnMainThread(() =>
            {
                FetchAddresses();
                FetchPaymentOptions();
                FetchCartList();
            });

            EditCommand          = new DelegateCommand(EditClicked);
            AddAddressCommand    = new DelegateCommand(AddAddressClicked);
            PlaceOrderCommand    = new DelegateCommand(PlaceOrderClicked);
            PaymentOptionCommand = new DelegateCommand(PaymentOptionClicked);
            ApplyCouponCommand   = new DelegateCommand(ApplyCouponClicked);

            MessagingCenter.Subscribe <RecorderViewModel, PredictionData>(this, callerPage, MessageCenterSubmitAsync);
        }
 /// <summary>
 /// Initializes a new instance for the <see cref="WishlistViewModel" /> class.
 /// </summary>
 public WishlistViewModel(IWishlistDataService wishlistDataService, ICartDataService cartDataService)
 {
     this.wishlistDataService = wishlistDataService;
     this.cartDataService     = cartDataService;
 }
Exemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance for the <see cref="CatalogPageViewModel" /> class.
        /// </summary>
        public CatalogPageViewModel(string callerPage, ICatalogDataService catalogDataService, ICartDataService cartDataService,
                                    IWishlistDataService wishlistDataService, string selectedCategory)
        {
            this.catalogDataService  = catalogDataService;
            this.cartDataService     = cartDataService;
            this.wishlistDataService = wishlistDataService;

            Device.BeginInvokeOnMainThread(() =>
            {
                UpdateCartItemCount();
                FetchProducts(selectedCategory);
            });

            MessagingCenter.Subscribe <RecorderViewModel, PredictionData>(this, callerPage, MessageCenterSubmitAsync);
        }
        /// <summary>
        /// Initializes a new instance for the <see cref="DetailPageViewModel" /> class.
        /// </summary>
        public DetailPageViewModel(string callerPage, ICatalogDataService catalogDataService, ICartDataService cartDataService,
                                   IWishlistDataService wishlistDataService, Product selectedProduct)
        {
            this.catalogDataService  = catalogDataService;
            this.cartDataService     = cartDataService;
            this.wishlistDataService = wishlistDataService;
            this.selectedProduct     = selectedProduct;

            Device.BeginInvokeOnMainThread(() =>
            {
                AddRecentProduct(selectedProduct.ID.ToString());
                FetchProduct(selectedProduct.ID.ToString());
                UpdateCartItemCount();
            });

            AddFavouriteCommand = new DelegateCommand(AddFavouriteClicked);
            NotificationCommand = new DelegateCommand(NotificationClicked);
            AddToCartCommand    = new DelegateCommand(AddToCartClicked);
            LoadMoreCommand     = new DelegateCommand(LoadMoreClicked);
            ShareCommand        = new DelegateCommand(ShareClicked);
            VariantCommand      = new DelegateCommand(VariantClicked);
            CardItemCommand     = new DelegateCommand(CartClicked);
            BackButtonCommand   = new DelegateCommand(BackButtonClicked);


            MessagingCenter.Subscribe <RecorderViewModel, PredictionData>(this, callerPage, MessageCenterSubmitAsync);
        }