Example #1
0
        public List <ShoppingCartResultSet> AddShoppingCartItemList(ShoppingCartItemListDTO shoppingCartItemListDTO)
        {
            CartRepository cartRepository = new CartRepository();
            var            currentUser    = ClaimsPrincipal.Current.Identity.Name;
            UserService    userService    = new UserService();

            if (shoppingCartItemListDTO != null && shoppingCartItemListDTO.shoppingCartDTOList != null && shoppingCartItemListDTO.shoppingCartDTOList.Count > 0 &&
                currentUser != null)
            {
                var user = userService.GetUser(currentUser);

                _shoppingCartRepository.Add(shoppingCartItemListDTO.shoppingCartDTOList, user.UserId);
                return(GetShoppingCartItemForUser(user.UserId));
            }
            return(null);
        }
Example #2
0
        public DiscountResult GetCartDiscount(ShoppingCartItemListDTO shoppingCartItemListDTO)
        {
            CartRepository cartRepository = new CartRepository();
            var            currentUser    = ClaimsPrincipal.Current.Identity.Name;
            UserService    userService    = new UserService();

            if (shoppingCartItemListDTO != null && shoppingCartItemListDTO.shoppingCartDTOList != null && shoppingCartItemListDTO.shoppingCartDTOList.Count > 0 &&
                currentUser != null)
            {
                var user = userService.GetUser(currentUser);
                var shoppingCartItemList = GetShoppingCartItemForUser(user.UserId);

                //Get Discount details.
                DiscountResult discountDetails = _shoppingCartRepository.GetDiscountDetails(shoppingCartItemListDTO.couponCode);
            }
            return(null);
        }