Example #1
0
 public ICollection <TabelaPreco> GetAllTabelaPreco()
 {
     using (var context = new WebServiceDBContext())
     {
         return(context.TabelaPrecos.ToList());
     }
 }
Example #2
0
 public ICollection <Product> GetAll()
 {
     using (var context = new WebServiceDBContext())
     {
         return(context.Produtcs.ToList());
     }
 }
Example #3
0
 public ICollection <TypeProduct> GetAllTypeProduct()
 {
     using (var context = new WebServiceDBContext())
     {
         return(context.TypeProduct.ToList());
     }
 }
Example #4
0
 public void UpdateProduct(Product p)
 {
     using (var context = new WebServiceDBContext())
     {
         context.Entry(p).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
Example #5
0
 public void AddProduct(Product p)
 {
     using (var context = new WebServiceDBContext())
     {
         context.Produtcs.Add(p);
         context.SaveChanges();
     }
 }
Example #6
0
 public void UpdateTabelaPreco(TabelaPreco tab)
 {
     using (var context = new WebServiceDBContext())
     {
         context.Entry(tab).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
Example #7
0
 public void AddTypeProduct(TypeProduct typePro)
 {
     using (var context = new WebServiceDBContext())
     {
         context.TypeProduct.Add(typePro);
         context.SaveChanges();
     }
 }
Example #8
0
 public void RemoveProduct(long id)
 {
     using (var context = new WebServiceDBContext())
     {
         Product product = context.Produtcs.Find(id);
         context.Entry(product).State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Example #9
0
 public void RemoveTabelaPreco(long id)
 {
     using (var context = new WebServiceDBContext())
     {
         TabelaPreco tab = context.TabelaPrecos.Find(id);
         context.Entry(tab).State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Example #10
0
        public Product GetProduct(long id)
        {
            Product prod = null;

            using (var context = new WebServiceDBContext())
            {
                prod = context.Produtcs.Find(id);
            }

            return(prod);
        }
Example #11
0
        public TabelaPreco GetTabelaPreco(long id)
        {
            TabelaPreco tab = null;

            using (var context = new WebServiceDBContext())
            {
                tab = context.TabelaPrecos.Find(id);
            }

            return(tab);
        }
Example #12
0
        public TypeProduct GetTypeProduct(long id)
        {
            TypeProduct tproduct = null;

            using (var context = new WebServiceDBContext())
            {
                tproduct = context.TypeProduct.Find(id);
            }

            return(tproduct);
        }
Example #13
0
        public void AddTabelaPreco(TabelaPreco tp)
        {
            using (var context = new WebServiceDBContext())
            {
                foreach (Product p in tp.producs)
                {
                    context.Produtcs.Attach(p);
                    context.Entry(p).State = EntityState.Unchanged;
                }

                context.TabelaPrecos.Add(tp);
                context.SaveChanges();
            }
        }