Esempio n. 1
0
        private async void Alterar()
        {
            if (View != null && View.Id > 0)
            {
                var cursoExistente = cursoService.ObterPorId(View.Id);
                if (cursoExistente != null)
                {
                    Request.Id           = View.Id;
                    Request.CargaHoraria = View.CargaHoraria;
                    Request.Valor        = View.Valor;
                    cursoExistente       = cursoService.Alterar(Request, "Carlosg");
                    if (cursoService.Validar)
                    {
                        Progresso = await dialog.ShowProgressAsync(this, "Progresso", "Alterando dados do curso. Aguarde...");

                        Progresso.SetIndeterminate();
                        await Progresso?.CloseAsync();

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

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

                        cursoService.LimparNotificacoes();
                    }
                    BuscarCursos();
                }
            }
        }