public IActionResult GetAll() { try { var eventoBll = new EventosBll(); var listaDeEventos = eventoBll.ObterTodos(); return(listaDeEventos); } catch (Exception ex) { Console.WriteLine(ex.Message); return(StatusCode(500)); } }
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)); } }
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)); } }
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)); } }