Esempio n. 1
0
        public static List <Articulos> GetList(Expression <Func <Articulos, bool> > filter)
        {
            List <Articulos> Lista = null;

            try
            {
                ContextoArt dbase = new ContextoArt();
                Lista = dbase.Art.Where(filter).ToList();
            }
            catch (Exception)
            {
                throw;
            }
            return(Lista);
        }
Esempio n. 2
0
        public static Articulos Buscar(int Id)
        {
            Articulos Articulo = new Articulos();

            try
            {
                ContextoArt dbase = new ContextoArt();
                Articulo = dbase.Art.Find(Id);
            }
            catch (Exception)
            {
                throw;
            }

            return(Articulo);
        }
Esempio n. 3
0
        public static bool Modificar(Articulos Art)
        {
            bool paso = false;

            try
            {
                ContextoArt dbase = new ContextoArt();

                dbase.Entry(Art).State = EntityState.Modified;
                dbase.SaveChanges();
                paso = true;
            }
            catch (Exception)
            {
                throw;
            }

            return(paso);
        }
Esempio n. 4
0
        public static bool Eliminar(int Id)
        {
            bool paso = false;

            try
            {
                ContextoArt dbase = new ContextoArt();
                Articulos   Art   = dbase.Art.Find(Id);

                dbase.Art.Remove(Art);
                dbase.SaveChanges();
                paso = true;
            }
            catch (Exception)
            {
                throw;
            }

            return(paso);
        }
Esempio n. 5
0
        public static bool Guardar(Articulos Ar)
        {
            bool paso = false;

            try
            {
                ContextoArt dbase = new ContextoArt();

                dbase.Art.Add(Ar);
                dbase.SaveChanges();
                Arti = Ar;
                paso = true;
            }
            catch (Exception)
            {
                throw;
            }

            return(paso);
        }