TopShelfCustomer/TopShelfCustomer/ViewModels/OrderHistoryViewModel.cs
/// <summary>
/// InitializeReceipts:
///
/// Populates the receipt list from the API
/// and the global User instance.
/// </summary>
/// <param name="email"> The User's email to search by </param>


Populates the receipt list from the API
and the global User instance.
Populates the receipt list from the API and the global User instance .
private async void InitializeReceipts( string email ) {
                ApiHelper api = new ApiHelper();
                string sanitizedEmail = email.Replace( ".", "-" );      
                string apiEndpoint = "Order/GetOrdersByEmail/" + sanitizedEmail;
                foreach ( OrderReceipt order in UserContainer.Orders ) {        
                    ReceiptList.Add( order );
                }
                List<OrderReceipt> orders = await api.GetAsync<List<OrderReceipt>>( apiEndpoint );      
                foreach( OrderReceipt order in orders ) {       
                    ReceiptList.Add( order );
                }
            }
private async void InitializeReceipts ( string email ) { ApiHelper api = new ApiHelper ( ) ; string sanitizedEmail = email . Replace ( " " , " " ) ; string apiEndpoint = " " + sanitizedEmail ; foreach ( OrderReceipt order in UserContainer . Orders ) { ReceiptList . Add ( order ) ; } List < OrderReceipt > orders = await api . GetAsync < List < OrderReceipt > > ( apiEndpoint ) ; foreach ( OrderReceipt order in orders ) { ReceiptList . Add ( order ) ; } }
InitializeReceipts:
InitializeReceipts :
//Make endpoint url-friendly //Fetch orders from global User //Fetch orders from API //Add orders to bindable collection
email
string
The User's email to search by
The User ' s email to search by