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)); } }
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)); } }
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)); } }
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)); } }
public Evento buscar(int CodEvento) { Evento evento = null; try { evento = new EventoBll().buscar(new Evento() { CodEvento = CodEvento }); } catch (Exception ex) { } return(evento); }
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)); } }