Example #1
0
        private async Task <CartViewModel> GetCartViewModelAsync()
        {
            if (_signInManager.IsSignedIn(User))
            {
                return(await _cartViewModelService.GetOrCreateCartForUser(User.Identity.Name));
            }

            string anonymousId = GetOrSetCartCookie();

            return(await _cartViewModelService.GetOrCreateCartForUser(anonymousId));
        }
Example #2
0
        private async Task <CartViewModel> GetCartViewModelAsync()
        {
            if (_signInManager.IsSignedIn(HttpContext.User))
            {
                return(await _cartService.GetOrCreateCartForUser(User.Identity.Name));
            }

            string anonymousId = GetCartIdFromCookie();

            if (anonymousId == null)
            {
                return(new CartViewModel());
            }
            return(await _cartService.GetOrCreateCartForUser(anonymousId));
        }