Example #1
0
        public bool addArticle(BEArticle art)
        {
            bool            res = false;
            bdshoesEntities dc;

            articles nuevo = new articles
            {
                id             = art.id,
                name           = art.name,
                description    = art.description,
                price          = art.price,
                store_id       = art.store_id,
                total_in_shelf = art.total_in_shelf,
                total_in_vault = art.total_in_vault,
            };

            using (dc = new bdshoesEntities())
            {
                dc.articles.Add(nuevo);
                dc.SaveChanges();

                art.id = nuevo.id;

                res = art.id > 0;
            }

            return(res);
        }
Example #2
0
        public List <BEStore> getStores()
        {
            List <BEStore>  lista = null;
            bdshoesEntities dc;

            using (dc = new bdshoesEntities())
            {
                lista = dc.stores.Select(a => new BEStore
                {
                    id      = a.id,
                    name    = a.name,
                    address = a.address,
                }).OrderBy(b => b.name).ToList();
            }

            return(lista);
        }
Example #3
0
        private List <BEArticle> getArticlesByStoreId(short?storeId)
        {
            List <BEArticle> lista = new List <BEArticle>();
            bdshoesEntities  dc;

            using (dc = new bdshoesEntities())
            {
                lista = dc.articles.Where(b => (storeId == null || b.store_id == storeId)).Select(a => new BEArticle
                {
                    id             = a.id,
                    name           = a.name,
                    description    = a.description,
                    store_id       = a.store_id,
                    price          = a.price,
                    total_in_shelf = a.total_in_shelf,
                    total_in_vault = a.total_in_vault,
                    store_name     = a.stores.name,
                }).OrderBy(a => a.name).ToList();
            }

            return(lista);
        }