Exemple #1
0
 public void UpdateProduct(Product p)
 {
     using (var context = new WebServiceDBContext())
     {
         context.Entry(p).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
Exemple #2
0
 public void UpdateTabelaPreco(TabelaPreco tab)
 {
     using (var context = new WebServiceDBContext())
     {
         context.Entry(tab).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
Exemple #3
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();
     }
 }
Exemple #4
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();
     }
 }
Exemple #5
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();
            }
        }