public DTOEmprestimo Insert(DTOEmprestimo emprestimo) { var aluno = db.Aluno.Find(emprestimo.Aluno.ID); emprestimo.Aluno = aluno; db.Emprestimo.Add(emprestimo); db.SaveChanges(); return emprestimo; }
public bool Update(DTOEmprestimo emprestimo) { bool resultado = false; try { var emp = db.Emprestimo.Find(emprestimo.ID); if(emp != null){ db.Entry(emp).CurrentValues.SetValues(emprestimo); db.SaveChanges(); resultado = true; } } catch (Exception e) { } return resultado; }
public DTOEmprestimo InserirEmprestimo(DTOEmprestimo emprestimo) { return DALEmp.Insert(emprestimo); }
public bool AlterarEmprestimo(DTOEmprestimo emprestimo) { return DALEmp.Update(emprestimo); }
// PUT api/emprestimo/5 public bool Put(DTOEmprestimo produto) { BLLEmprestimo BLLobjeto = new BLLEmprestimo(); return BLLobjeto.AlterarEmprestimo(produto); }
// GET api/emprestimo/Teste/5 /*[Route("api/emprestimo/teste/{id}")] public string GetTeste(int id) { return "Teste sucesso"; }*/ // POST api/emprestimo public DTOEmprestimo Post(DTOEmprestimo produto) { BLLEmprestimo BLLobjeto = new BLLEmprestimo(); return BLLobjeto.InserirEmprestimo(produto); }