Esempio n. 1
0
 public IActionResult GetAll()
 {
     try
     {
         var eventoBll      = new EventosBll();
         var listaDeEventos = eventoBll.ObterTodos();
         return(listaDeEventos);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }
Esempio n. 2
0
 public IActionResult Put(int id, [FromBody] EventoModelView eventoModelView)
 {
     try
     {
         var eventoBll = new EventosBll();
         eventoBll.Atualizar(id, eventoModelView);
         return(NoContent());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }
Esempio n. 3
0
 public IActionResult GetComId(int id)
 {
     try
     {
         var eventoBll = new EventosBll();
         var evento    = eventoBll.ObterPorId(id);
         return(Json(evento));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }
Esempio n. 4
0
 public IActionResult Post([FromBody] EventoModelView eventoModelView)
 {
     try
     {
         var eventoBll = new EventosBll();
         eventoBll.Inserir(eventoModelView);
         return(NoContent());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }