EventDay / Infusionsoft.net

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

Add orderby #7

Closed mrmoses closed 11 years ago

mrmoses commented 11 years ago

I added functions for using the optional orderBy and ascending parameters with DataService.query.

I'm not that familiar with this implementation, so there may be a better way to add this functionality, but this was getting the job done for me.

I "have not tested every bit, of every call, in every direction, for every scenario" either :)

trbngr commented 11 years ago

This is unnecessary.

You would simply call .OrderBy(entity=>entity.Propery) or .OrderByDescending(entity=>entity.Propery) on the resulting dataset.

Thanks for helping out though. I don't really have the time lately.

mrmoses commented 11 years ago

.OrderByDescending(c => c.DateCreated) will sort the resulting dataset, but the resulting dataset would not necessarily be the most recently created entities.

If you have more entities than the max page size (1000), and you request the first page without the orderBy paramenter, the resulting dataset contains the first 1000 entities according to the default sort.

This does not get the most recently created companies if you have more than 1000 companies.

client.DataService.Query<Company>(DataPage.First).OrderByDescending(c => c.DateCreated)
trbngr commented 11 years ago

Oh man. You're so right.

I'll pull this and check it out.

Thanks.