Beispiel #1
0
        public async Task <ActionResult <Evento> > Get(int id)
        {
            var evento = await _repositorio.BuscarPorID(id);

            if (evento == null)
            {
                return(NotFound());
            }
            return(evento);
        }
        public ActionResult <Evento> Get(int id)
        {
            Evento evento = _repositorio.BuscarPorID(id);

            if (evento == null)
            {
                return(NotFound(new { mensagem = "Nenhum usuário encontrado para o ID informado" }));
            }

            return(evento);
        }
Beispiel #3
0
        public async Task <ActionResult <Evento> > Get(int id)
        {
            // FindAsync (Select * from Evento where id = id)
            var Evento = await _repositorio.BuscarPorID(id);

            if (Evento == null)
            {
                return(NotFound());
            }
            return(Evento);
        }
        public async Task <ActionResult <Evento> > Get(int id)
        {
            //  FindAsync = procura algo específico no banco
            Evento evento = await _contexto.BuscarPorID(id);

            if (evento == null)
            {
                return(NotFound());
            }

            return(evento);
        }
Beispiel #5
0
        public async Task <ActionResult <Evento> > Get(int id)
        {
            // FindAsync = procura
            // FirstOrDefaultAsync(x => x.IdNomedocampo == id)
            // c => c.IdCategoria
            var evento = await _repositorio.BuscarPorID(id);

            if (evento == null)
            {
                return(NotFound());
            }
            return(evento);
        }