예제 #1
0
        public async Task HandleFile(IFileListEntry[] files)
        {
            Alunos.Clear();
            if (files.Length != 0)
            {
                file = files.FirstOrDefault();
                var dados = new StreamReader(file.Data);
                if (file != null)
                {
                    while (true)
                    {
                        var info = await dados.ReadLineAsync();

                        if (info == null)
                        {
                            break;
                        }
                        var aluno = info.Split(';');
                        if (aluno[0] != "Id")
                        {
                            Alunos.Add(new Aluno
                            {
                                Matricula = Convert.ToInt32(aluno[0]),
                                Nome      = aluno[1],
                                CursoId   = Convert.ToInt32(aluno[2])
                            });
                        }
                    }
                }
            }
        }
예제 #2
0
        public void CarregarAlunos()
        {
            var alunos = App.AlunoModel.GetAlunos().OrderBy(a => a.Nome).ToList();

            Alunos.Clear();
            for (int index = 0; index < alunos.Count; index++)
            {
                Alunos.Add(alunos[index]);
            }
        }
예제 #3
0
        private void RefreshListAlunos()
        {
            lock (locker)
            {
                var alunos = (from c in _database.Table <Aluno>()
                              select c).ToList();

                Alunos.Clear();
                foreach (var item in alunos)
                {
                    Alunos.Add(item);
                }
            }
        }
예제 #4
0
 async private void CarregarObservable()
 {
     if (!IsBusy)
     {
         IsBusy = true;
         Alunos.Clear();
         var observable = AlunoService.CarregarAlunos();
         if (observable != null)
         {
             foreach (var aluno in observable.Alunos)
             {
                 Alunos.Add(aluno);
             }
         }
         IsBusy = false;
     }
 }
예제 #5
0
        private async void ModalClose(ModalResult result)
        {
            if (!result.Cancelled)
            {
                isLoading = true;
                Alunos.Clear();
                StateHasChanged();
                await Client.DeleteAsync($"/api/alunos/{AlunoId}");

                Message      = "Aluno deletado com sucesso!";
                MessageColor = "Color:Green";
                await GetAlunos();

                StateHasChanged();
            }
            isLoading      = false;
            Modal.OnClose -= ModalClose;
        }