public IHttpActionResult RecuperarDB(int?id = null) { try { AlunoModel aluno = new AlunoModel(); return(Ok(aluno.ListarAlunoDB(id))); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult Put(int id, [FromBody] AlunoDTO aluno) { try { AlunoModel _aluno = new AlunoModel(); aluno.id = id; _aluno.AtualizarDB(aluno); return(Ok(_aluno.ListarAlunoDB(id))); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult Post(AlunoDTO aluno) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { AlunoModel _aluno = new AlunoModel(); _aluno.InserirDB(aluno); return(Ok(_aluno.ListarAlunoDB())); } catch (Exception ex) { return(InternalServerError(ex)); } }