Exemple #1
0
        public static Eventos Buscar(int id)
        {
            Contexto db      = new Contexto();
            Eventos  eventos = new Eventos();

            try
            {
                eventos = db.Eventos.Find(id);
            }
            catch
            {
                throw;
            }
            finally
            {
                db.Dispose();
            }
            return(eventos);
        }
Exemple #2
0
        public static bool Modificar(Eventos eventos)
        {
            Contexto db   = new Contexto();
            bool     paso = false;

            try
            {
                db.Entry(eventos).State = EntityState.Modified;
                paso = (db.SaveChanges() > 0);
            }
            catch
            {
                throw;
            }
            finally
            {
                db.Dispose();
            }
            return(paso);
        }
Exemple #3
0
        public static bool Insertar(Eventos eventos)
        {
            Contexto db   = new Contexto();
            bool     paso = false;

            try
            {
                if (db.Eventos.Add(eventos) != null)
                {
                    paso = (db.SaveChanges() > 0);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                db.Dispose();
            }
            return(paso);
        }