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

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

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

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

                    alunoService.ClearNotifications();
                }
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Excluir(int id)
        {
            try
            {
                var resultado = await _alunoService.Excluir(id);

                return(Ok(Resultado <string> .OK(resultado)));
            }
            catch (ValidacaoException e)
            {
                return(Ok(Resultado <string> .Erro(e.Message)));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
 public bool ExcluirAluno([FromUri] int id)
 {
     return(_alunoService.Excluir(id));
 }
Exemplo n.º 4
0
 public void Excluir(int id)
 {
     _alunoService.Excluir(id);
 }