示例#1
0
        private async Task <Wishlist> GetExistingOrCreateNewWishlist(string userName)
        {
            var wishlist = await _wishlistRepository.GetByUserNameAsync(userName);

            if (wishlist != null)
            {
                return(wishlist);
            }

            // if it is first attempt create new
            var newWishlist = new Wishlist
            {
                UserName = userName
            };

            await _wishlistRepository.AddAsync(newWishlist);

            return(newWishlist);
        }