public object Update(tbPregunta pregunta)
        {
            try
            {
                using (var contexto = new DB_DACSEntities())
                {
                    result = contexto.tbPregunta.SingleOrDefault(x => x.pre_id == pregunta.pre_id);

                    if (result != null)
                    {
                        result.pre_pregunta           = pregunta.pre_pregunta;
                        result.pre_respuesta_positiva = pregunta.pre_respuesta_positiva;
                        contexto.SaveChanges();
                    }
                    else
                    {
                        throw new Exception("No se encontro el objeto a actualizar");
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public object Create(tbPregunta pregunta)
 {
     try
     {
         using (var contexto = new DB_DACSEntities())
         {
             result = contexto.tbPregunta.Add(pregunta);
             contexto.SaveChanges();
         }
         return(result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public object Read()
 {
     try
     {
         using (var contexto = new DB_DACSEntities())
         {
             contexto.Configuration.LazyLoadingEnabled = false;
             listaResult = contexto.tbPregunta.ToList <tbPregunta>();
         }
         return(listaResult);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 //public object Update(E entity)
 public E Update(E entity)
 {
     try
     {
         using (var contexto = new DB_DACSEntities())
         {
             contexto.Entry(entity).State = System.Data.Entity.EntityState.Modified;
             contexto.SaveChanges();
             return(entity);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public object Read(Func <E, bool> predicado)
 {
     try
     {
         using (var contexto = new DB_DACSEntities())
         {
             contexto.Configuration.LazyLoadingEnabled = false;
             listaResult = contexto.Set <E>().Where(predicado).ToList <E>();
         }
         return(listaResult);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public object Delete(tbPregunta pregunta)
 {
     try
     {
         using (var contexto = new DB_DACSEntities())
         {
             contexto.tbPregunta.Attach(pregunta);
             result = contexto.tbPregunta.Remove(pregunta);
             contexto.SaveChanges();
         }
         return(result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public object Delete(E entity)
 {
     try
     {
         using (var contexto = new DB_DACSEntities())
         {
             contexto.Set <E>().Attach(entity);
             result = contexto.Set <E>().Remove(entity);
             contexto.SaveChanges();
         }
         return(result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 //public object Create(E entity)
 public E Create(E entity)
 {
     try
     {
         using (var contexto = new DB_DACSEntities())
         {
             contexto.Configuration.LazyLoadingEnabled = false;
             result = contexto.Set <E>().Add(entity);
             contexto.SaveChanges();
         }
         return(result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public ServiceTipArtRepository()
 {
     _contexto = new DB_DACSEntities();
 }
 public ServiceComercioRepository()
 {
     _contexto = new DB_DACSEntities();
 }
Exemplo n.º 11
0
 public ServiceArticuloRepository()
 {
     _contexto = new DB_DACSEntities();
 }
Exemplo n.º 12
0
 public ServiceErpAsesoresRepository()
 {
     _contexto = new DB_DACSEntities();
 }
Exemplo n.º 13
0
 public ServiceBaseRepository()
 {
     _contexto = new DB_DACSEntities();
 }
Exemplo n.º 14
0
 public ServiceConfigurationRepository()
 {
     _contexto = new DB_DACSEntities();
 }
Exemplo n.º 15
0
 public ServiceErpLocalidadesRepository()
 {
     _contexto = new DB_DACSEntities();
 }
Exemplo n.º 16
0
 public ServiceErpEmpresasRepository()
 {
     _contexto = new DB_DACSEntities();
 }