diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
| commit | 225aa1499e37faf9d38257caabbadc68d78b427e (patch) | |
| tree | 102bb7a40c58595348ae9d3c7076201759fe0720 /Decompiler/Gestor.Application.ViewModels.Generic/ReordenarItensViewModel.cs | |
| parent | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff) | |
| download | gestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip | |
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.ViewModels.Generic/ReordenarItensViewModel.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.ViewModels.Generic/ReordenarItensViewModel.cs | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/ReordenarItensViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/ReordenarItensViewModel.cs new file mode 100644 index 0000000..27ca9c2 --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/ReordenarItensViewModel.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public class ReordenarItensViewModel : BaseSegurosViewModel +{ + private readonly ItemServico _itemServico; + + private bool _carregando; + + private ObservableCollection<Item> _itens = new ObservableCollection<Item>(); + + public bool Carregando + { + get + { + return _carregando; + } + set + { + _carregando = value; + OnPropertyChanged("Carregando"); + } + } + + public ObservableCollection<Item> Itens + { + get + { + return _itens; + } + set + { + _itens = value; + OnPropertyChanged("Itens"); + } + } + + public ReordenarItensViewModel(List<long> ids) + { + _itemServico = new ItemServico(); + CarregarItens(ids); + } + + private async void CarregarItens(List<long> ids) + { + Carregando = true; + Itens = await _itemServico.BuscarItens(ids); + Carregando = false; + } + + public void ReordenarAutomaticamente() + { + foreach (Item iten in Itens) + { + iten.Ordem = Itens.IndexOf(iten) + 1; + } + Itens = new ObservableCollection<Item>(Itens); + } +} |