Пример #1
0
        public List <departamento> ListarDepartamentos()
        {
            var Departamentos = new List <departamento>();

            try
            {
                using (var context = new TransContext())
                {
                    Departamentos = context.departamento.ToList();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            return(Departamentos);
        }
Пример #2
0
        public clientes getCliente(int id)
        {
            var Cliente = new clientes();

            try
            {
                using (var context = new TransContext())
                {
                    Cliente = context.clientes.Include("departamento1").Where(x => x.id == id).Single();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            return(Cliente);
        }
Пример #3
0
        public List <clientes> ListarClientes()
        {
            var Clientes = new List <clientes>();

            try
            {
                using (var context = new TransContext())
                {
                    Clientes = context.clientes.ToList();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            return(Clientes);
        }
Пример #4
0
 public void Guardar()
 {
     try
     {
         using (var context = new TransContext())
         {
             //if(this.id == 0)
             //{
             context.Entry(this).State = EntityState.Added;
             //}
             context.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }