public ImmutableList <CheckoutItemDto> GetCheckoutList()
        {
            var cookieHandler = new BasketCookie(_cookiesIn);
            var service       = new CheckoutCookieService(cookieHandler.GetValue());

            return(GetCheckoutList(service.LineItems));
        }
예제 #2
0
        public CheckoutDto GetCheckoutInfoFromCookie()
        {
            var cookieHandler = new CheckoutCookie(_cookiesIn);
            var service       = new CheckoutCookieService(cookieHandler.GetValue());

            return(GetCheckoutInfoFromCookie(service));
        }
예제 #3
0
        public ImmutableList <CheckoutItemDto> GetCheckoutList()
        {
            var checkoutCookieService = new CheckoutCookieService(cookiesIn);
            var lineItems             = checkoutCookieService.LineItems;

            return(GetCheckoutList(lineItems));
        }
예제 #4
0
        public CheckoutDto GetCheckoutInfoFromCookie(CheckoutCookieService checkoutCookie)
        {
            var bookList = new List <CheckoutItemDto>();

            foreach (var lineItem in checkoutCookie.LineItems)
            {
                bookList.Add(_context.Books.Select(book => new CheckoutItemDto
                {
                    BookId      = book.BookId,
                    Title       = book.Title,
                    AuthorsName = string.Join(", ",
                                              book.AuthorsLink
                                              .OrderBy(q => q.Order)
                                              .Select(q => q.Author.Name)),
                    BookPrice = book.ActualPrice,
                    ImageUrl  = book.ImageUrl,
                    NumBooks  = lineItem.NumBooks
                }).Single(y => y.BookId == lineItem.BookId));
            }

            return(new CheckoutDto(checkoutCookie.UserId.ToString(), bookList));
        }