예제 #1
0
 public IActionResult GetComId(int id)
 {
     try
     {
         var eventoBll = new EventoBll();
         var evento    = eventoBll.ObterPorId(id);
         return(Json(evento));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }
예제 #2
0
 public IActionResult Put(int id, [FromBody] EventoModelView eventoModelView)
 {
     try
     {
         var eventoBll = new EventoBll();
         eventoBll.Atualizar(id, eventoModelView);
         return(NoContent());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }
예제 #3
0
 public IActionResult Post([FromBody] EventoModelView eventoModelView)
 {
     try
     {
         var eventoBll = new EventoBll();
         eventoBll.Insert(eventoModelView);
         return(NoContent());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }
예제 #4
0
 public IActionResult GetAll()
 {
     try
     {
         var eventoBll      = new EventoBll();
         var listaDeEventos = eventoBll.obterTodos();
         return(Json(listaDeEventos));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }
예제 #5
0
        public Evento buscar(int CodEvento)
        {
            Evento evento = null;

            try
            {
                evento = new EventoBll().buscar(new Evento()
                {
                    CodEvento = CodEvento
                });
            }
            catch (Exception ex)
            {
            }

            return(evento);
        }
예제 #6
0
 public IActionResult Put([FromRoute] int id, [FromBody] EventoModelView eventoModelView)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     try
     {
         var eventoBll = new EventoBll();
         eventoBll.Update(id, eventoModelView);
         return(NoContent());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(StatusCode(500));
     }
 }