Bukimedia / PrestaSharp

CSharp .Net client library for the PrestaShop API via web service
GNU General Public License v3.0
155 stars 153 forks source link

How sort order_state #364

Closed ghost closed 4 years ago

ghost commented 5 years ago

¿Como usar el metodo sort de la entidad order_State? Quiero ordenar los estados, sin usar GetByFilter

Dim PSStates As New Bukimedia.PrestaSharp.Factories.OrderStateFactory(frmConfig.GetWSUrl, frmConfig.GetWSLoginUser, frmConfig.GetWSKey) Dim States As New List(Of Bukimedia.PrestaSharp.Entities.order_state)

    States = PSStates.GetAll
    States.Sort()

'** States = PSStates.GetByFilter(Nothing, "id_desc", "") 'esto funciona, pero no quiero usarlo, pues me gustaría conectar el funcionamiento de sort '**

oromand commented 4 years ago

Sorting has to be made thanks to Linq. One basic example may be:

ProductFactory factory= new ProductFactory(TestUrl, TestApiKey, null);

var orderedProducts = factory.GetAll().OrderByDescending(d => d.id);
ghost commented 4 years ago

Gracias. Se que por rendimiento es igual, pero queria conocer esta función orderbydescending. thanks. the isue are equal filter or GetAll, but now a know this method.