public usuario Get(int id) { using (PticketsEntities pticketsEntities = new PticketsEntities()) { return(pticketsEntities.usuario.FirstOrDefault(e => e.usuario_id == id)); } }
public ticket Get(int id) { using (PticketsEntities pticketsEntities = new PticketsEntities()) { return(pticketsEntities.ticket.FirstOrDefault(e => e.ticket_id == id)); } }
public IEnumerable <usuario> Get() { using (PticketsEntities pticketsEntities = new PticketsEntities()) { return(pticketsEntities.usuario.ToList()); } }
public fila Get(int id) { using (PticketsEntities pticketsEntities = new PticketsEntities()) { return(pticketsEntities.fila.FirstOrDefault(e => e.fila_id == id)); } }
public IEnumerable <ticket> Get() { using (PticketsEntities pticketsEntities = new PticketsEntities()) { return(pticketsEntities.ticket.ToList()); } }
public compra Get(int id) { using (PticketsEntities pticketsEntities = new PticketsEntities()) { return(dbContext.compra.FirstOrDefault(e => e.compra_id == id)); } }
public IEnumerable <compra> Get() { using (PticketsEntities pticketsEntities = new PticketsEntities()) { return(dbContext.compra.ToList()); } }
public IEnumerable <fila> Get() { using (PticketsEntities pticketsEntities = new PticketsEntities()) { IQueryable <fila> query = dbContext.fila.Include(m => m.sala); return(query.ToList()); } }
public IEnumerable <object> GetExistencias() { using (PticketsEntities pticketsEntities = new PticketsEntities()) { var salaIni = from s in dbContext.sala join f in dbContext.fila on s.sala_id equals f.sala_id into fLeft from fl in fLeft.DefaultIfEmpty() join t in dbContext.ticket on fl.fila_id equals t.fila_id into tLeft from ti in tLeft.DefaultIfEmpty() group new { fl.cantidad, fl.fila_id, ti.ticket_id } by new { s.sala_id, s.nombre } into grp select new { sala_id = grp.Key.sala_id, nombre = grp.Key.nombre, numTotal = grp.Select(fil => new { fil.cantidad, fil.fila_id }).Distinct().Sum(fil => (int?)fil.cantidad ?? 0), //numTotal = grp.Sum(fil => (int?)fil.cantidad ?? 0), numOcupado = grp.Count(tck => ((int?)tck.ticket_id ?? 0) > 0) }; return(salaIni.ToList()); } }
public object Get(int id) { using (PticketsEntities pticketsEntities = new PticketsEntities()) { //return pticketsEntities.sala.Include(s => s.fila.Select(f => f.ticket)).FirstOrDefault(s => s.sala_id == id); return(pticketsEntities.sala .Select(s => new { sala_id = s.sala_id, nombre = s.nombre, fila = s.fila.Select(f => new { f.fila_id, f.nombre, f.cantidad, ticket = f.ticket.Select(t => new { t.ticket_id, t.num_asiento }) }).OrderBy(f => f.nombre), //ticket = s.fila.Select(f => f.ticket.Select(t => new { t.ticket_id, t.num_asiento })) }).FirstOrDefault(s => s.sala_id == id)); //return pticketsEntities.sala // .Select(s => new { // sala_id = s.sala_id, // nombre = s.nombre, // fila = s.fila.Select(f => new { f.fila_id, f.nombre, f.cantidad }).OrderBy(f => f.nombre), // ticket = s.fila.Select(f => f.ticket.Select(t => new { t.ticket_id, t.num_asiento })) // }).FirstOrDefault(s => s.sala_id == id); } }