EventDay / Infusionsoft.net

A C# Wrapper around the Infusionsoft.com API
15 stars 22 forks source link

How to query with multiple parameters? #26

Closed UserSud closed 9 years ago

UserSud commented 9 years ago

Hi, hope you can help me with some sample code on how I can use the DataService to perform querying with multiple parameters and perhaps sorting as well.

Actually I'm trying to fetch the latest order from a given ContactId At the moment I an get all the orders for a given contact with:

Client.DataService.Query(q => q.Add(x => x.ContactId, 1))

Can you show me how I can query for just the latest Job for a given contactId please?

Many thanks in advance!

Sud

simonlongson commented 9 years ago

Can you not do a .singleOrDefault() to the end of that? May need to do an .orderByDescending(x => x.id) also if you can.

UserSud commented 9 years ago

Will that pull all the orders over from Infusionsoft before the filtering or will that only return a single record through the api?

trbngr commented 9 years ago

That will pull all orders. I'm not aware of a way to single out the latest in the Infusionsoft API.