Esempio n. 1
0
        public List <SuperZEnt.Articles> ListArticles()
        {
            List <SuperZEnt.Articles> lista = new List <SuperZEnt.Articles>();

            using (var superArticles = new SuperZapatosEntities2())
            {
                lista = superArticles.Articles.ToList();
            }
            return(lista);
        }
Esempio n. 2
0
        public int Delete(int id)
        {
            int ret = 0;

            using (var superArticles = new SuperZapatosEntities2())
            {
                SuperZEnt.Articles art = superArticles.Articles.First(x => x.id == id);
                superArticles.Articles.Remove(art);
                ret = superArticles.SaveChanges();
            }
            return(ret);
        }
Esempio n. 3
0
        public int Edit(SuperZEnt.Stores store)
        {
            int ret = 0;

            using (var superStores = new SuperZapatosEntities2())
            {
                SuperZEnt.Stores art = superStores.Stores.First(x => x.id == store.id);
                art.id      = store.id;
                art.name    = store.name;
                art.address = store.address;
                ret         = superStores.SaveChanges();
            }
            return(ret);
        }
Esempio n. 4
0
        public int Edit(SuperZEnt.Articles article)
        {
            int ret = 0;

            using (var superArticles = new SuperZapatosEntities2())
            {
                SuperZEnt.Articles art = superArticles.Articles.First(x => x.id == article.id);
                art.id             = article.id;
                art.name           = article.name;
                art.description    = article.description;
                art.price          = article.price;
                art.store_id       = article.store_id;
                art.total_in_vault = article.total_in_shelf;
                art.total_in_shelf = article.total_in_shelf;
                ret = superArticles.SaveChanges();
            }
            return(ret);
        }
Esempio n. 5
0
        public int Save(SuperZEnt.Articles article)
        {
            int ret = 0;

            using (var superArticles = new SuperZapatosEntities2())
            {
                var art = superArticles.Articles
                          .Where(b => b.id == article.id)
                          .FirstOrDefault();
                if (art == null)
                {
                    superArticles.Articles.Add(article);
                    ret = superArticles.SaveChanges();
                }
                else
                {
                    ret = -1;
                }
            }
            return(ret);
        }
Esempio n. 6
0
        public int Save(SuperZEnt.Stores store)
        {
            int ret = 0;

            using (var superStores = new SuperZapatosEntities2())
            {
                var stor = superStores.Stores
                           .Where(b => b.id == store.id)
                           .FirstOrDefault();

                if (stor == null)
                {
                    superStores.Stores.Add(store);
                    ret = superStores.SaveChanges();
                }
                else
                {
                    ret = -1;
                }
            }
            return(ret);
        }