public static bool Guardar(Clientes cliente) { bool retorno = false; try { using (var db = new EjemploDetalleDb()) { if (Buscar(cliente.ClienteId) == null) { db.Cliente.Add(cliente); } else { db.Entry(cliente).State = EntityState.Modified; } db.SaveChanges(); } retorno = true; } catch (Exception) { throw; } return(retorno); }
public static bool Guardar(Productos productos) { bool retorno = false; try { using (var db = new EjemploDetalleDb()) { if (Buscar(productos.ProductoId) == null) { db.Producto.Add(productos); } else { db.Entry(productos).State = EntityState.Modified; } db.SaveChanges(); } retorno = true; } catch (Exception) { throw; } return(retorno); }
public static bool Guardar(Models.CotizacionesDetalles detalle) { bool retorno = false; try { using (var db = new EjemploDetalleDb()) { if (Buscar(detalle.DetalleId) == null) { db.CotizacionDetalle.Add(detalle); } else { db.Entry(detalle).State = EntityState.Modified; } db.SaveChanges(); } retorno = true; } catch (Exception) { throw; } return(retorno); }
public static bool Insertar(Grupos gp) { bool retorno = false; try { var db = new EjemploDetalleDb(); db.Grupos.Add(gp); var gr = db.Grupos.Add(gp); foreach (var est in gp.Estudiantes) { db.Entry(est).State = EntityState.Unchanged; } db.SaveChanges(); //db.Dispose(); retorno = true; } catch (Exception) { throw; } return(retorno); }
public static Estudiantes Buscar(int id) { Estudiantes estudiante = new Estudiantes(); var db = new EjemploDetalleDb(); return(estudiante = db.Estudiantes.Find(id)); }
public static bool Guardar(Cotizaciones cotizacion) { bool retorno = false; try { using (var db = new EjemploDetalleDb()) { if (Buscar(cotizacion.CotizacionId) == null) { db.Cotizacion.Add(cotizacion); } else { db.Entry(cotizacion).State = EntityState.Modified; } foreach (var cotizaciones in cotizacion.Detalle) { db.Entry(cotizaciones).State = EntityState.Unchanged; } db.SaveChanges(); } retorno = true; } catch (Exception) { throw; } return(retorno); }
public static List <Clientes> GetLista() { List <Clientes> lista = new List <Clientes>(); EjemploDetalleDb db = new EjemploDetalleDb(); lista = db.Cliente.ToList(); return(lista); }
public static void Eliminar(int id) { var db = new EjemploDetalleDb(); Grupos g = db.Grupos.Find(id); db.Grupos.Remove(g); db.SaveChanges(); }
public static Grupos Buscar(int id) { Grupos grupos = new Grupos(); var db = new EjemploDetalleDb(); grupos = db.Grupos.Find(id); return(grupos); }
public static List <Models.CotizacionesDetalles> GetLista(int id) { List <Models.CotizacionesDetalles> lista = new List <Models.CotizacionesDetalles>(); EjemploDetalleDb db = new EjemploDetalleDb(); lista = db.CotizacionDetalle.Where(u => u.DetalleId == id).ToList(); return(lista); }
public static List <Productos> GetLista(int id) { List <Productos> lista = new List <Productos>(); EjemploDetalleDb db = new EjemploDetalleDb(); lista = db.Producto.Where(u => u.ProductoId == id).ToList(); return(lista); }
public static List <Estudiantes> GetLista(int id) { List <Estudiantes> lista = new List <Estudiantes>(); EjemploDetalleDb db = new EjemploDetalleDb(); lista = db.Estudiantes.Where(u => u.EstudianteId == id).ToList(); return(lista); }
public static List <Models.CotizacionesDetalles> GetLista() { List <Models.CotizacionesDetalles> lista = new List <Models.CotizacionesDetalles>(); EjemploDetalleDb db = new EjemploDetalleDb(); lista = db.CotizacionDetalle.ToList(); return(lista); }
public static List <Productos> GetLista() { List <Productos> lista = new List <Productos>(); EjemploDetalleDb db = new EjemploDetalleDb(); lista = db.Producto.ToList(); return(lista); }
public static void Eliminar(int id) { var db = new EjemploDetalleDb(); Estudiantes Es = db.Estudiantes.Find(id); db.Estudiantes.Remove(Es); db.SaveChanges(); }
public static List <Grupos> GetLista() { var lista = new List <Grupos>(); var db = new EjemploDetalleDb(); lista = db.Grupos.ToList(); return(lista); }
public static List <Grupos> GetListaGrupos(int id) { List <Grupos> lista = new List <Grupos>(); var db = new EjemploDetalleDb(); lista = db.Grupos.Where(p => p.GrupoId == id && p.Estudiantes.Count > 0).ToList(); return(lista); }
public static List <Estudiantes> GetListaNombres(string aux) { List <Estudiantes> lista = new List <Estudiantes>(); var db = new EjemploDetalleDb(); lista = db.Estudiantes.Where(p => p.Nombres == aux).ToList(); return(lista); }
public static Clientes Buscar(int id) { Clientes client = new Clientes(); using (EjemploDetalleDb db = new EjemploDetalleDb()) { client = db.Cliente.Find(id); } return(client); }
public static CotizacionesDetalles Buscar(int id) { CotizacionesDetalles cotizacion = new CotizacionesDetalles(); using (EjemploDetalleDb db = new EjemploDetalleDb()) { cotizacion = db.CotizacionDetalle.Find(id); } return(cotizacion); }
public static Productos Buscar(int id) { Productos pro = new Productos(); using (EjemploDetalleDb db = new EjemploDetalleDb()) { pro = db.Producto.Find(id); } return(pro); }
public static List <Estudiantes> GetLista() { var lista = new List <Estudiantes>(); var db = new EjemploDetalleDb(); lista = db.Estudiantes.ToList(); return(lista); }
public static Cotizaciones Buscar(int id) { Cotizaciones date = null; using (var db = new EjemploDetalleDb()) { date = db.Cotizacion.Find(id); if (date != null) { date.Detalle.Count(); } } return(date); }
public static bool Eliminar(int id) { bool retorno = false; try { using (EjemploDetalleDb db = new EjemploDetalleDb()) { Productos user = (from c in db.Producto where c.ProductoId == id select c).FirstOrDefault(); db.Producto.Remove(user); db.SaveChanges(); retorno = true; } } catch (Exception) { throw; } return(retorno); }
public static bool Eliminar(int id) { bool retorno = false; try { using (EjemploDetalleDb db = new EjemploDetalleDb()) { Models.CotizacionesDetalles user = (from c in db.CotizacionDetalle where c.DetalleId == id select c).FirstOrDefault(); db.CotizacionDetalle.Remove(user); db.SaveChanges(); retorno = true; } } catch (Exception) { throw; } return(retorno); }
public static bool Insertar(Estudiantes est) { bool retorno = false; try { var db = new EjemploDetalleDb(); db.Estudiantes.Add(est); db.SaveChanges(); db.Dispose(); retorno = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } return(retorno); }