public ImmutableList <CheckoutItemDto> GetCheckoutList() { var cookieHandler = new BasketCookie(_cookiesIn); var service = new CheckoutCookieService(cookieHandler.GetValue()); return(GetCheckoutList(service.LineItems)); }
public CheckoutDto GetCheckoutInfoFromCookie() { var cookieHandler = new CheckoutCookie(_cookiesIn); var service = new CheckoutCookieService(cookieHandler.GetValue()); return(GetCheckoutInfoFromCookie(service)); }
public ImmutableList <CheckoutItemDto> GetCheckoutList() { var checkoutCookieService = new CheckoutCookieService(cookiesIn); var lineItems = checkoutCookieService.LineItems; return(GetCheckoutList(lineItems)); }
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)); }