void OrderList(string orderBy) { _dialogService.ShowLoading("Atualizando"); if (orderBy.Equals(EnumOrderType.Preco.GetDescription())) { Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.PrecoVenda)); } if (orderBy.Equals(EnumOrderType.Dormitorios.GetDescription())) { Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.Dormitorios)); } if (orderBy.Equals(EnumOrderType.Suites.GetDescription())) { Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.Suites)); } if (orderBy.Equals(EnumOrderType.Vagas.GetDescription())) { Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.Vagas)); } if (orderBy.Equals(EnumOrderType.AreaTotal.GetDescription())) { Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.AreaTotal)); } _dialogService.HideLoading(); }
void OrderList(string orderBy) { _dialogService.ShowLoading("Reordenando"); try { if (orderBy.Equals(EnumOrderType.Preco.GetDescription())) { Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.PrecoVenda)); } if (orderBy.Equals(EnumOrderType.Dormitorios.GetDescription())) { Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.Dormitorios)); } if (orderBy.Equals(EnumOrderType.Suites.GetDescription())) { Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.Suites)); } if (orderBy.Equals(EnumOrderType.Vagas.GetDescription())) { Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.Vagas)); } if (orderBy.Equals(EnumOrderType.AreaTotal.GetDescription())) { Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.AreaTotal)); } _dialogService.HideLoading(); } catch (Exception ex) { _dialogService.ShowToast(EnumToastType.Error, ex.Message); _dialogService.HideLoading(); } }