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); }
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); }
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); }
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); } }