Beispiel #1
0
        public int AddToCart(IUnitOfWork unitOfWork, ICartService cartService, Product product)
        {
            var cartItem = cartService.ODataQueryable().SingleOrDefault(
                    c => c.CartId == ShoppingCartId
                    && c.ProductId == product.Id);

            if (cartItem == null)
            {
                cartItem = new Cart
                {
                    CartId = ShoppingCartId,
                    ProductId = product.Id,
                    Count = 1,
                    DateCreated = DateTime.Now
                };
                cartService.Insert(cartItem);
            }
            else
            {
                cartItem.Count++;
                cartService.Update(cartItem);
            }

            //save changes
            unitOfWork.SaveChanges();
            return cartItem.Count;
        }
 public CountingController()
 {
     this.userService = new UserService();
     this.productReviewService = new ProductReviewService();
     this.productService = new ProductService();
     this.cartService = new CartService();
 }
Beispiel #3
0
        public Order CreateOrder(IUnitOfWork unitOfWork, ICartService cartService, IOrderService orderService, IOrderDetailService orderDetailService,
            IProductService productService, ICategoryService categoryService, Order order)
        {
            decimal orderTotal = 0;
            var cartItems = GetCartItems(cartService, productService, categoryService);
            foreach (var item in cartItems)
            {
                var orderDetail = new OrderDetail
                {
                    ProductId = item.ProductId,
                    OrderId = order.Id,
                    UnitPrice = item.Product.Price,
                    Quantity = item.Count
                };
                orderTotal += (item.Count * item.Product.Price);
                orderDetailService.Insert(orderDetail);
            }
            // update total into order
            order.Total = orderTotal;
            orderService.Update(order);

            // commit to changes
            unitOfWork.SaveChanges();

            //emty cart session
            EmptyCart(unitOfWork, cartService);

            return order;
        }
 /// <summary>
 /// CTR
 /// </summary>
 /// <param name="themes"></param>
 public CheckoutController(ICartService carts, ThemeService themes, ITaxService taxes, IShippingService shipping)
 {
     _CartService = carts;
     _ThemeService = themes;
     _TaxService = taxes;
     _ShippingService = shipping;
 }
 public CountingController(IUserService userService, IProductReviewService productReviewService, IProductService productService, ICartService cartService)
 {
     this.userService = userService;
     this.productReviewService = productReviewService;
     this.productService = productService;
     this.cartService = cartService;
 }
 public CartItemViewModelFactory(
     IContentLoader contentLoader,
     IPricingService pricingService,
     UrlResolver urlResolver,
     ICurrentMarket currentMarket,
     ICurrencyService currencyService,
     IPromotionService promotionService,
     AppContextFacade appContext,
     ILineItemCalculator lineItemCalculator,
     IProductService productService, 
     IRelationRepository relationRepository, 
     ICartService cartService)
 {
     _contentLoader = contentLoader;
     _pricingService = pricingService;
     _urlResolver = urlResolver;
     _currentMarket = currentMarket;
     _currencyService = currencyService;
     _promotionService = promotionService;
     _appContext = appContext;
     _lineItemCalculator = lineItemCalculator;
     _productService = productService;
     _relationRepository = relationRepository;
     _cartService = cartService;
 }
 public CurrencyController(ICurrencyService currencyService, 
     ICartService cartService, 
     IOrderRepository orderRepository)
 {
     _currencyService = currencyService;
     _cartService = cartService;
     _orderRepository = orderRepository;
 }
Beispiel #8
0
 public OrderService(ICartService cartService,
     IRepository<Order> orderRepository,
     IRepository<Snapshot> snapshotRepository)
 {
     _cartService = cartService;
     _orderRepository = orderRepository;
     _snapshotRepository = snapshotRepository;
 }
Beispiel #9
0
        /// <summary>
        /// CTR
        /// </summary>
        /// <param name="themes"></param>
        public CartController(ThemeService themes, ICartService carts)
        {
            if (themes == null) throw new ArgumentNullException("themes");
            if (carts == null) throw new ArgumentNullException("carts");

            _ThemeService = themes;
            _CartService = carts;
        }
 public CartController(
     ICartService cartService,
     IOrderRepository orderRepository,
     CartViewModelFactory cartViewModelFactory)
 {
     _cartService = cartService;
     _orderRepository = orderRepository;
     _cartViewModelFactory = cartViewModelFactory;
 }
        public NavigationController(IContentLoader contentLoader, ICartService cartService, ICartService wishListService, UrlHelper urlHelper, LocalizationService localizationService)
        {
            _contentLoader = contentLoader;
            _cartService = cartService;
            _wishListService = wishListService;
            _urlHelper = urlHelper;
            _localizationService = localizationService;

            _wishListService.InitializeAsWishList();
        }
Beispiel #12
0
 public CartController(IContentLoader contentLoader,
                       ICartService cartService,
                       ICartService wishListService,
                       IProductService productService)
 {
     _contentLoader = contentLoader;
     _cartService = cartService;
     _wishListService = wishListService;
     _productService = productService;
     _wishListService.InitializeAsWishList();
 }
Beispiel #13
0
 public CartController(
     UserManager<User> userManager,
     IRepository<CartItem> cartItemRepository,
     ICartService cartService,
     IMediaService mediaService,
     IWorkContext workContext)
 {
     _cartItemRepository = cartItemRepository;
     _cartService = cartService;
     _mediaService = mediaService;
     _workContext = workContext;
 }
 public ShoppingCartController(IUnitOfWork unitOfWork, ICategoryService categoryService,
     IProductService productService,
     IOrderService orderService, IOrderDetailService orderDetailService,
     ICartService cartService)
 {
     this._unitOfWork = unitOfWork;
     this._categoryService = categoryService;
     this._productService = productService;
     this._orderService = orderService;
     this._orderDetailService = orderDetailService;
     this._cartService = cartService;
 }
 public NavigationController(
     IContentLoader contentLoader, 
     ICartService cartService, 
     UrlHelper urlHelper, 
     LocalizationService localizationService,
     CartViewModelFactory cartViewModelFactory)
 {
     _contentLoader = contentLoader;
     _cartService = cartService;
     _urlHelper = urlHelper;
     _localizationService = localizationService;
     _cartViewModelFactory = cartViewModelFactory;
 }
Beispiel #16
0
        public CartController(ICartService cartService, IProductService productService)
        {
            if (cartService == null)
            {
                throw new ArgumentNullException("cartService");
            }

            if (productService == null)
            {
                throw new ArgumentNullException("productService");
            }

            this.cartService = cartService;
            this.productService = productService;
        }
 public MarketController(
     IMarketService marketService, 
     ICurrentMarket currentMarket, 
     UrlResolver urlResolver, 
     LanguageService languageService, 
     ICartService cartService,
     ICurrencyService currencyService)
 {
     _marketService = marketService;
     _currentMarket = currentMarket;
     _urlResolver = urlResolver;
     _languageService = languageService;
     _cartService = cartService;
     _currencyService = currencyService;
 }
 public CheckoutController(IUnitOfWork unitOfWork, ICategoryService categoryService,
     IOrderService orderService, IOrderDetailService orderDetailService,
     ICartService cartService, IEmailQueueService emailQueueService,
     IProductService productService,
     IEmailTemplateService emailTemplateService, IContentService content)
 {
     this._unitOfWork = unitOfWork;
     this._categoryService = categoryService;
     this._productService = productService;
     this._orderService = orderService;
     this._orderDetailService = orderDetailService;
     this._cartService = cartService;
     this._emailQueueService = emailQueueService;
     this._emailTemplateService = emailTemplateService;
     this._content = content;
 }
Beispiel #19
0
 public CartController(ICartService cartService, UserManager <User> userManager)
 {
     _cartService = cartService;
     _userManager = userManager;
 }
 public CartController(ICartService cartService)
 {
     this.cartService = cartService;
 }
 public CartController(IBookService bookService, ICartService cartService, IBookValidation bookValidation)
 {
     _bookService = bookService;
     _cartService = cartService;
     _bookValidation = bookValidation;
 }
Beispiel #22
0
 // update cart
 public int UpdateCart(IUnitOfWork unitOfWork, ICartService cartService, int itemId, int quantity)
 {
     var cartItem = cartService.ODataQueryable().Single(
         c => c.CartId == ShoppingCartId
             && c.ProductId == itemId);
     if (cartItem != null && cartItem.Count > 0)
     {
         if (quantity.Equals(0))
             cartService.Delete(cartItem);
         else
         {
             cartItem.Count = quantity;
             cartService.Update(cartItem);
         }
         unitOfWork.SaveChanges();
     }
     return quantity;
 }
Beispiel #23
0
 public CartsControllerTests()
 {
     this.cartService = Substitute.For <ICartService>();
     this.controller  = Substitute.For <CartsController>(this.cartService);
     this.fixture     = new Fixture();
 }
 public ShoppingCartController(ICartService cartService, IBookService bookService)
 {
     _cartService = cartService;
     _bookService = bookService;
 }
Beispiel #25
0
 public void MigrateCart(IUnitOfWork unitOfWork, ICartService cartService, string userName)
 {
     var shoppingCart = cartService.ODataQueryable().Where(x => x.CartId == ShoppingCartId);
     foreach (var item in shoppingCart)
     {
         item.CartId = userName;
     }
     unitOfWork.SaveChanges();
 }
Beispiel #26
0
 public EmailService(IServiceProvider provider, ILogger <EmailService> logger, ICartService cartService)
 {
     this.provider    = provider;
     this.logger      = logger;
     this.cartService = cartService;
 }
Beispiel #27
0
 public DefaultPaymentAccountant(ILogger logger, IOrderService orderService, IPaymentTransactionService paymentTransactionService, ICartService cartService, IStoreCreditService storeCreditService, AffiliateSettings affiliateSettings)
 {
     _logger       = logger;
     _orderService = orderService;
     _paymentTransactionService = paymentTransactionService;
     _cartService        = cartService;
     _storeCreditService = storeCreditService;
     _affiliateSettings  = affiliateSettings;
 }
 public ProductController(IProductService productService, UserManager <ApplicationUser> userManager, ICartService cartService)
 {
     _productService = productService;
     _userManager    = userManager;
     _cartService    = cartService;
 }
Beispiel #29
0
 public CartController(ICartService cartService)
 {
     _cartService = cartService;
 }
Beispiel #30
0
 public SaleService(ApplicationDbContext context, IMapper mapper, ICountryService countryService, IProductService productService, ICartService cartService, IPaymentMethodService paymentMethodService)
     : base(context)
 {
     this.countryService       = countryService;
     this.productService       = productService;
     this.cartService          = cartService;
     this.paymentMethodService = paymentMethodService;
 }
 public CartCommandHandler(ICartService cartService, IShardingService shardingService, IEventSender eventSender)
 {
     _cartService     = cartService;
     _shardingService = shardingService;
     _eventSender     = eventSender;
 }
Beispiel #32
0
 public CartController(IOrderService orderService, ICartService cartService, UserManager <ApplicationUser> userManager)
 {
     _orderService = orderService;
     _cartService  = cartService;
     _userManager  = userManager;
 }
 public CartViewComponent(ICartService CartService) => _CartService = CartService;
Beispiel #34
0
 public CartController(IHttpClientFactory clientFactory, ICartService service)
 {
     this.clientFactory = clientFactory;
     this.service       = service;
 }
Beispiel #35
0
 public DeletePartFromCartCommand(CartViewModel cartViewModel, ICartService cartService, IAuthentificator authentificator)
 {
     _cartViewModel   = cartViewModel;
     _cartService     = cartService;
     _authentificator = authentificator;
 }
Beispiel #36
0
 public GooglePayPaymentController(ICartService cartService, IOrderRepository orderRepository)
 {
     _cartService     = cartService;
     _orderRepository = orderRepository;
 }
Beispiel #37
0
 public UserController(IUserService userService, ICartService cartService)
 {
     _userService = userService;
     _cartService = cartService;
 }
Beispiel #38
0
 public CartController(ICartService CartService) => _CartService = CartService;
Beispiel #39
0
 // remove item from cart
 public int RemoveFromCart(IUnitOfWork unitOfWork, ICartService cartService, int productId)
 {
     var cartItem = cartService.ODataQueryable().Single(
         c => c.CartId == ShoppingCartId
             && c.ProductId == productId);
     //int itemCount = 0;
     //if (cartItem != null)
     //{
     //    if (cartItem.Count > 1)
     //    {
     //        cartItem.Count--;
     //        itemCount = cartItem.Count;
     //        cartService.Update(cartItem);
     //    }
     //    else
     //    {
     cartService.Delete(cartItem);
     //}
     unitOfWork.SaveChanges();
     //}
     return 0;
 }
Beispiel #40
0
 public SqlOrderService(WebStoreDB dB, ICartService cart, UserManager <User> userManager)
 {
     _dB          = dB;
     _cart        = cart;
     _userManager = userManager;
 }
Beispiel #41
0
 public CartItemController(ICartService cartService, ICartItemService cartItemService)
 {
     _cartService     = cartService;
     _cartItemService = cartItemService;
 }
Beispiel #42
0
        /// <summary>
        /// Constructor
        /// </summary>
        public CartViewModel(INavigationService navigationService, ICartService cartService, IGamesService gameService,
            IOrderService orderService)
        {
            this.navigationService = navigationService;
            this.cartService = cartService;
            this.gameService = gameService;
            this.orderService = orderService;

            Order = new Order();
        }
 public CartController(ICartService cartService, IUserService userService)
 {
     _cartService = cartService;
     _userService = userService;
 }
 public AccountController(IAuthenticationService authenticationService, IUserService userService, ICartService cartService)
 {
     _authenticationService = authenticationService;
     _userService = userService;
     _cartService = cartService;
 }        
Beispiel #45
0
 public CartController(ICartService CartService, IOrderService OrderService)
 {
     _CartService  = CartService;
     _OrderService = OrderService;
 }
Beispiel #46
0
 public PriceAccountant(IDiscountCouponService discountCouponService, IUserService userService, ICartItemService cartItemService, IProductService productService, ITaxAccountant taxAccountant, TaxSettings taxSettings, ICartService cartService, IProductVariantService productVariantService, IRoundingService roundingService, IOrderService orderService)
 {
     _discountCouponService = discountCouponService;
     _userService           = userService;
     _cartItemService       = cartItemService;
     _productService        = productService;
     _taxAccountant         = taxAccountant;
     _taxSettings           = taxSettings;
     _cartService           = cartService;
     _productVariantService = productVariantService;
     _roundingService       = roundingService;
     _orderService          = orderService;
 }
 public PointOfSaleTerminal(ICartService cartService, IProductRangeService productRangeService)
 {
     _cartService         = cartService;
     _productRangeService = productRangeService;
 }
Beispiel #48
0
 public CartController(ICartService cartService)
 {
     _cartService = cartService;
 }
 public AccountController(UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, IEmailSender emailSender, ICartService cartService)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _emailSender   = emailSender;
     _cartService   = cartService;
 }
Beispiel #50
0
 public GetCartByUserIdHandler(ICartService cartService, IMapper mapper)
 {
     this.cartService = cartService;
     this.mapper      = mapper;
 }
 public OrderSummaryViewComponent(ICartService cartService, IWorkContext workContext)
 {
     _cartService = cartService;
     _workContext = workContext;
 }
Beispiel #52
0
 public CartManager(ICartService cartService, IProductService productService)
 {
     _cartService    = cartService;
     _productService = productService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CartController" /> class.
 /// </summary>
 /// <param name="service">The service.</param>
 public CartController(ICartService service)
 {
     this.Service = service;
 }
 public CartController(IIdentityService <ApplicationUser> identityService, ICartService cartService, ICatalogService catalogService)
 {
     _identityService = identityService;
     _cartService     = cartService;
     _catalogService  = catalogService;
 }
Beispiel #55
0
 public Handler(ICartService cartService,
                ApplicationDbContext context)
 {
     _cartService = cartService;
     _context     = context;
 }
 public TournamentsListController(ITournamentsListService tournamentListService, Settings settings, ICartService cartService)
 {
     this.tournamentListService = tournamentListService;
     this.settings    = settings;
     this.cartService = cartService;
 }
 public CartController(IAlbumService albumService, ICartService cartService, ICookieStorageService cookieStorageService)
 {
     _albumService = albumService;
     _cartService = cartService;
     _cookieStorageService = cookieStorageService;
 }
Beispiel #58
0
 public ApiListsController(IWorkContextAccessor workContextAccessor, ICatalogService catalogService, ICartService cartService, ICartBuilder cartBuilder, IStorefrontUrlBuilder urlBuilder)
     : base(workContextAccessor, urlBuilder)
 {
     _cartBuilder    = cartBuilder;
     _catalogService = catalogService;
     _cartService    = cartService;
 }
Beispiel #59
0
 public CartList(ICartService cartService) => _cartService = cartService;
 public OrderController(ICartService cartService, IOrderService orderService, IMapper mapper)
 {
     _cartService  = cartService;
     _orderService = orderService;
     _mapper       = mapper;
 }