Esempio n. 1
0
 public void eliminar()
 {
     try
     {
         using (var db = new RrestauranteModel())
         {
             db.Entry(this).State = EntityState.Deleted;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 6
0
        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);
        }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
        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);
        }
Esempio n. 14
0
        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);
        }
Esempio n. 15
0
        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);
        }
Esempio n. 16
0
        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);
        }
Esempio n. 17
0
        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);
        }
Esempio n. 18
0
        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);
        }
Esempio n. 19
0
        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);
        }
Esempio n. 20
0
        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);
        }
Esempio n. 21
0
        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);
        }
Esempio n. 22
0
        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);
        }
Esempio n. 23
0
 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;
     }
 }