public void eliminar() { try { using (var db = new RrestauranteModel()) { db.Entry(this).State = EntityState.Deleted; db.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public List <pedido_cabecera> Listar() { var empre = new List <pedido_cabecera>(); try { using (var db = new RrestauranteModel()) { empre = db.pedido_cabecera.Include(x => x.pedido_detalle.Select(y => y.plato)).OrderByDescending(z => z.fecha).ThenBy(a => a.estado).ToList(); } } catch (Exception ex) { throw ex; } return(empre); }
public List <plato> Listar() { var empre = new List <plato>(); try { using (var db = new RrestauranteModel()) { empre = db.plato.Include(r => r.restaurante).Include(p => p.plato_categoria).ToList(); } } catch (Exception ex) { throw ex; } return(empre); }
public empresa_restaurante_usuario Obtener(int id) { var empre = new empresa_restaurante_usuario(); try { using (var db = new RrestauranteModel()) { empre = db.empresa_restaurante_usuario.Include("empresa").Include("restaurante").Include("usuario").Where(x => x.restaurante_usuario_id == id).SingleOrDefault(); } } catch (Exception ex) { throw ex; } return(empre); }
public List <empresa_restaurante_usuario> buscar(string criterio) { var empre = new List <empresa_restaurante_usuario>(); try { using (var db = new RrestauranteModel()) { empre = db.empresa_restaurante_usuario.Include("empresa").Include("restaurante").Include("usuario").Where(x => x.empresa.nombre.Contains(criterio)).ToList(); } } catch (Exception ex) { throw ex; } return(empre); }
public restaurante_tipo Obtener(int id) { var empre = new restaurante_tipo(); try { using (var db = new RrestauranteModel()) { empre = db.restaurante_tipo.Include("restaurante").Include("tipo_restaurante").Where(x => x.restaurante_tipo_id == id).SingleOrDefault(); } } catch (Exception ex) { throw ex; } return(empre); }
public List <empresa_restaurante_usuario> Listar() { var empre = new List <empresa_restaurante_usuario>(); try { using (var db = new RrestauranteModel()) { empre = db.empresa_restaurante_usuario.Include("empresa").Include("restaurante").Include("usuario").ToList(); } } catch (Exception ex) { throw ex; } return(empre); }
public List <restaurante_tipo> Listar() { var empre = new List <restaurante_tipo>(); try { using (var db = new RrestauranteModel()) { empre = db.restaurante_tipo.Include("restaurante").Include("tipo_restaurante").ToList(); } } catch (Exception ex) { throw ex; } return(empre); }
public List <pedido_detalle> buscar(string criterio) { var empre = new List <pedido_detalle>(); try { using (var db = new RrestauranteModel()) { empre = db.pedido_detalle.Where(x => x.plato.nombre.Contains(criterio)).ToList(); } } catch (Exception ex) { throw ex; } return(empre); }
public pedido_detalle Obtener(int id) { var empre = new pedido_detalle(); try { using (var db = new RrestauranteModel()) { empre = db.pedido_detalle.Where(x => x.pedido_detalle_id == id).SingleOrDefault(); } } catch (Exception ex) { throw ex; } return(empre); }
public estado_usuario Obtener(int id) { var empre = new estado_usuario(); try { using (var db = new RrestauranteModel()) { empre = db.estado_usuario.Where(x => x.estado_usuario_id == id).SingleOrDefault(); } } catch (Exception ex) { throw ex; } return(empre); }
public List <plato_categoria> Listar() { var empre = new List <plato_categoria>(); try { using (var db = new RrestauranteModel()) { empre = db.plato_categoria.ToList(); } } catch (Exception ex) { throw ex; } return(empre); }
public List <tipo_restaurante> buscar(string criterio) { var empre = new List <tipo_restaurante>(); try { using (var db = new RrestauranteModel()) { empre = db.tipo_restaurante.Where(x => x.descripcion.Contains(criterio)).ToList(); } } catch (Exception ex) { throw ex; } return(empre); }
public tipo_restaurante Obtener(int id) { var empre = new tipo_restaurante(); try { using (var db = new RrestauranteModel()) { empre = db.tipo_restaurante.Where(x => x.tipo_restaurante_id == id).SingleOrDefault(); } } catch (Exception ex) { throw ex; } return(empre); }
public List <estado_usuario> Listar() { var empre = new List <estado_usuario>(); try { using (var db = new RrestauranteModel()) { empre = db.estado_usuario.ToList(); } } catch (Exception ex) { throw ex; } return(empre); }
public List <tipo_restaurante> Listar() { var empre = new List <tipo_restaurante>(); try { using (var db = new RrestauranteModel()) { empre = db.tipo_restaurante.ToList(); } } catch (Exception ex) { throw ex; } return(empre); }
public List <mesa> buscar(string criterio) { var empre = new List <mesa>(); try { using (var db = new RrestauranteModel()) { empre = db.mesa.Where(x => restaurante.nombre.Contains(criterio)).ToList(); } } catch (Exception ex) { throw ex; } return(empre); }
public mesa Obtener(int id) { var empre = new mesa(); try { using (var db = new RrestauranteModel()) { empre = db.mesa.Where(x => x.mesa_id == id).SingleOrDefault(); } } catch (Exception ex) { throw ex; } return(empre); }
public List <mesa> Listar() { var empre = new List <mesa>(); try { using (var db = new RrestauranteModel()) { empre = db.mesa.Include(r => r.restaurante).ToList(); } } catch (Exception ex) { throw ex; } return(empre); }
public mesa DesactivarMesa(int id) { var mesa = new mesa(); try { using (var db = new RrestauranteModel()) { mesa = db.mesa.Find(id); mesa.estado = "Inactivo"; db.SaveChanges(); } } catch (Exception ex) { throw ex; } return(mesa); }
public List <empresa> buscar(string criterio) { var empre = new List <empresa>(); try { using (var db = new RrestauranteModel()) { empre = db.empresa.Include("estado_empresa") .Where(x => x.nombre.Contains(criterio) || x.descripcion.Contains(criterio)).ToList(); } } catch (Exception ex) { throw ex; } return(empre); }
public pedido_cabecera CancelarPedido(int id) { var pedido = new pedido_cabecera(); try { using (var db = new RrestauranteModel()) { pedido = db.pedido_cabecera.Find(id); pedido.estado = "Cancelado"; db.SaveChanges(); } } catch (Exception ex) { throw ex; } return(pedido); }
public void guardar() { try { using (var db = new RrestauranteModel()) { if (this.tipo_restaurante_id > 0) { db.Entry(this).State = EntityState.Modified; } else { db.Entry(this).State = EntityState.Added; } db.SaveChanges(); } } catch (Exception ex) { throw ex; } }