public Receipt Checkout(ShoppingCart shoppingCart) { Receipt receipt = new Receipt(); if (shoppingCart == null) { throw new ArgumentNullException(); } receipt.ReceiptId = _shoppingRepository.GetReceiptId(); receipt.ReceiptItems = shoppingCart.ShoppingItems; receipt.TotalQuantity = receipt.ReceiptItems.Sum(x => x.ProductQuantity); receipt.TotalAmount = receipt.ReceiptItems.Sum(x => x.ProductTotalPrice); return(receipt); }