Esempio n. 1
0
        public Empresas GetEmpresaModel(int RUT)
        {
            List <Empresa> listaRetorno = new List <Empresa>();

            using (CEREBROEntities1 db = new CEREBROEntities1())
            {
                Empresas ListEmp = (from e in db.Empresas where e.RUT == RUT select e).ToList().First();
                return(ListEmp);
            }
        }
Esempio n. 2
0
 public void UpdateEmpresa(Empresa emp)
 {
     using (CEREBROEntities1 db = new CEREBROEntities1())
     {
         Empresas e = new Empresas();
         e = db.Empresas.Find(emp.RUT);
         e.setModel(emp);
         db.Entry(e).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Esempio n. 3
0
 public void AddEmpresa(Empresa emp)
 {
     using (CEREBROEntities1 db = new CEREBROEntities1())
     {
         if (emp != null)
         {
             Empresas nuevo = new Empresas();
             nuevo.setModel(emp);
             db.Empresas.Add(nuevo);
             db.SaveChanges();
         }
     }
 }
Esempio n. 4
0
        public void setModel(Usuario usu)
        {
            this.Email        = usu.mail;
            this.Id           = usu.Id;
            this.PasswordHash = usu.Pass;
            this.AspNetRoles  = new List <AspNetRoles>();
            this.AspNetRoles.Add(rol.GetRole(usu.Tipo_User));
            Empresas e = new Empresas();

            e.setModel(emp.GetEmpresa(usu.EmpresaRef));
            this.Empresas = new List <Empresas>();
            this.Empresas.Add(e);
        }