Ejemplo n.º 1
0
        public DTOEmprestimo Insert(DTOEmprestimo emprestimo)
        {
            var aluno = db.Aluno.Find(emprestimo.Aluno.ID);
            emprestimo.Aluno = aluno;

            db.Emprestimo.Add(emprestimo);
            db.SaveChanges();

            return emprestimo;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
 public DTOEmprestimo InserirEmprestimo(DTOEmprestimo emprestimo)
 {
     return DALEmp.Insert(emprestimo);
 }
Ejemplo n.º 4
0
 public bool AlterarEmprestimo(DTOEmprestimo emprestimo)
 {
     return DALEmp.Update(emprestimo);
 }
Ejemplo n.º 5
0
 // PUT api/emprestimo/5
 public bool Put(DTOEmprestimo produto)
 {
     BLLEmprestimo BLLobjeto = new BLLEmprestimo();
     return BLLobjeto.AlterarEmprestimo(produto);
 }
Ejemplo n.º 6
0
 // 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);
 }