Exemplo n.º 1
0
        private async void Alterar()
        {
            if (Aluno != null && Aluno.Id > 0)
            {
                var alunoExistente = alunoService.ObterPorId(Aluno.Id);
                alunoExistente.AlterarNome(Aluno.Nome);
                if (alunoExistente.Validar)
                {
                    Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Alterando dados do aluno. Aguarde...");

                    Progresso.SetIndeterminate();
                    var   t = Task.Factory.StartNew(() => { alunoService.Alterar(alunoExistente); });
                    await t;
                    await Progresso?.CloseAsync();

                    await this.dialog.ShowMessageAsync(this, "Atenção", "Aluno alterado com sucesso !!!");

                    Limpar();
                }
                else
                {
                    await this.dialog.ShowMessageAsync(this, "Atenção", string.Join("\r\n", alunoExistente.Notifications.Select(s => s.Mensagem)));

                    alunoService.ClearNotifications();
                }
            }
        }