Exemplo n.º 1
0
        public IActionResult Get()
        {
            IEnumerable <Aluno> lista = alunoBLL.GetAlunos();

            if (lista.ToList().Count > 0)
            {
                return(Ok(lista));
            }
            else
            {
                return(Ok(new List <Aluno>()));
            }
        }
Exemplo n.º 2
0
        public ActionResult Procurar(string procurarPor, string criterio)
        {
            AlunoBLL alunobll = new AlunoBLL();

            if (procurarPor == "Email")
            {
                Aluno aluno = alunobll.GetAlunos().SingleOrDefault(x => x.Email == criterio || criterio == null);
                return(View(aluno));
            }
            else
            {
                Aluno aluno = alunobll.GetAlunos().SingleOrDefault(x => x.Nome == criterio || criterio == null);
                return(View(aluno));
            }
        }
Exemplo n.º 3
0
        public IActionResult Index()
        {
            AlunoBLL            _aluno = new AlunoBLL();
            List <Models.Aluno> alunos = _aluno.GetAlunos().ToList();

            return(View("Lista", alunos));
        }
Exemplo n.º 4
0
        //Get
        //Mostra os dados do Aluno
        public ActionResult Edit(int id)
        {
            AlunoBLL alunobll = new AlunoBLL();
            Aluno    aluno    = alunobll.GetAlunos().Single(x => x.Id == id);

            return(View(aluno));
        }
Exemplo n.º 5
0
        // GET: Home
        //Exibi a lista de alunos
        public ActionResult Index()
        {
            //criei uma instancia da classe AlunoBLL
            AlunoBLL _aluno = new AlunoBLL();

            //estou usando o metodo getAlunos e retornando uma lista de alunos
            List <Aluno> alunos = _aluno.GetAlunos().ToList();

            return(View(alunos));
        }
Exemplo n.º 6
0
        public ActionResult Edit_Post([Bind(Exclude = "Nome")] Aluno aluno)
        {
            //Protegendo e controlando os Updates indesejaveis com Fiddler
            AlunoBLL alunobll = new AlunoBLL();

            aluno.Nome = alunobll.GetAlunos().Single(x => x.Id == aluno.Id).Nome; //Pegando o Nome do Banco

            //passando como parametros o id
            //Aluno aluno = alunobll.GetAlunos().Single(x => x.Id == id);
            //UpdateModel(aluno, includeProperties: new[] { "id", "Email", "Idade", "DataIncricao", "Sexo" });
            //UpdateModel(aluno, null, null, excludeProperties: new[] { "Nome" });


            if (ModelState.IsValid)
            {
                alunobll.AtualizarAluno(aluno);
                return(RedirectToAction("Index"));
            }

            return(View(aluno));
        }
Exemplo n.º 7
0
        public ActionResult Index()
        {
            IList <Aluno> lista = _alunoBLL.GetAlunos();

            return(View(lista));
        }
Exemplo n.º 8
0
 public ActionResult Index()
 {
     alunos = alunoBLL.GetAlunos().ToList();
     return(View(alunos));
 }