Beispiel #1
0
        public int editar(Laboratorio lab)
        {
            dbLaboratorioEntities context = new dbLaboratorioEntities();

            context.Entry(lab).State = EntityState.Modified;
            return(context.SaveChanges());
        }
Beispiel #2
0
        public int excluir(int id)
        {
            dbLaboratorioEntities context = new dbLaboratorioEntities();
            Laboratorio           s       = new Laboratorio();

            s.id = id;
            context.Entry(s).State = EntityState.Deleted;
            return(context.SaveChanges());
        }
Beispiel #3
0
        public bool Inserir(Laboratorio lab)
        {
            dbLaboratorioEntities context = new dbLaboratorioEntities();

            context.Laboratorio.Add(lab);
            int retorno = context.SaveChanges();

            return(retorno == 1);
        }
Beispiel #4
0
        public Laboratorio getById(int id)
        {
            dbLaboratorioEntities context = new dbLaboratorioEntities();
            var         lstLab            = (from l in context.Laboratorio where l.id == id select l);
            Laboratorio lab = new Laboratorio();

            foreach (var item in lstLab)
            {
                lab.id                 = item.id;
                lab.nome               = item.nome;
                lab.projetor           = item.projetor;
                lab.qtdeAlunos         = item.qtdeAlunos;
                lab.qtdeComputadores   = item.qtdeComputadores;
                lab.sistemaOperacional = item.sistemaOperacional;
                lab.software1          = item.software1;
                lab.software2          = item.software2;
                lab.software3          = item.software3;
            }

            return(lab);
        }
Beispiel #5
0
        public List <Laboratorio> Listar()
        {
            var context = new dbLaboratorioEntities();

            return(context.Laboratorio.ToList());
        }