public IActionResult RetornarTodos()
 {
     try
     {
         var _participanteBll = new ParticipanteBll();
         var listaParcipantes = _participanteBll.ObterTodos();
         return(Json(listaParcipantes));
     }
     catch (Exception e)
     {
         return(StatusCode(500));
     }
 }
 public IActionResult Delete([FromRoute] int id)
 {
     try
     {
         var participanteBll = new ParticipanteBll();
         participanteBll.Delete(id);
         return(NoContent());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }
 public IActionResult GetById([FromRoute] int id)
 {
     try
     {
         var participanteBll = new ParticipanteBll();
         var participante    = participanteBll.GetById(id);
         return(Json(participante));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }
 public IActionResult GetParticipantes()
 {
     try
     {
         var participanteBll   = new ParticipanteBll();
         var ListParticipantes = participanteBll.GetParticipantes();
         return(Json(ListParticipantes));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }
Exemplo n.º 5
0
 public IActionResult Put(int id, [FromBody] ParticipanteModelView participanteModelView)
 {
     try
     {
         var participanteBll = new ParticipanteBll();
         participanteBll.Atualizar(id, participanteModelView);
         return(NoContent());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }
Exemplo n.º 6
0
 public IActionResult Post([FromBody] ParticipanteModelView participanteModelView)
 {
     try
     {
         var participanteBll = new ParticipanteBll();
         participanteBll.Insert(participanteModelView);
         return(NoContent());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }
        public List <Participante> listar()
        {
            List <Participante> listParticipante = new List <Participante>();

            try
            {
                listParticipante = new ParticipanteBll().listar();
            }
            catch (Exception ex)
            {
            }

            return(listParticipante);
        }
Exemplo n.º 8
0
        public List <Participante> buscarListPorEvento(int codEvento)
        {
            List <Participante> listParticipante = new List <Participante>();

            try
            {
                listParticipante = new ParticipanteBll().buscarListPorEvento(codEvento);
            }
            catch (Exception ex)
            {
            }

            return(listParticipante);
        }
Exemplo n.º 9
0
        public List <Participante> buscarLista(Participante participante)
        {
            List <Participante> listParticipante = new List <Participante>();

            try
            {
                listParticipante = new ParticipanteBll().buscarLista(participante);
            }
            catch (Exception ex)
            {
            }

            return(listParticipante);
        }
 public IActionResult Delete(int idParticipante)
 {
     try
     {
         var _participanteBll = new ParticipanteBll();
         _participanteBll.Deletar(idParticipante);
         return(NoContent());
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(StatusCode(500));
     }
 }
 public IActionResult ObterPorId(int idParticipante)
 {
     try
     {
         var _participanteBll = new ParticipanteBll();
         var participante     = _participanteBll.ObterPorId(idParticipante);
         return(Json(participante));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(StatusCode(500));
     }
 }
Exemplo n.º 12
0
        public Participante buscar(int CodParticipante)
        {
            Participante participante = null;

            try
            {
                participante = new ParticipanteBll().buscar(new Participante()
                {
                    CodParticipante = CodParticipante
                });
            }
            catch (Exception ex)
            {
            }

            return(participante);
        }
 public IActionResult Put([FromRoute] int id, [FromBody] ParticipanteModelView participanteModelView)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     try
     {
         var participanteBll = new ParticipanteBll();
         var mensagem        = participanteBll.Update(id, participanteModelView);
         return(Ok(mensagem));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }