public void Put([FromBody] TabelaPreco tb) { using (var context = new WebServiceDBContext()) { context.Entry(tb).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void Put([FromBody] TypeProduct tp) { using (var context = new WebServiceDBContext()) { context.Entry(tp).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public HttpResponseMessage Delete(long id) { using (var context = new WebServiceDBContext()) { TypeProduct tp = context.TypeProduct.Find(id); context.Entry(tp).State = System.Data.Entity.EntityState.Deleted; context.SaveChanges(); } return(new HttpResponseMessage(HttpStatusCode.Accepted)); }
public void Post([FromBody] TabelaPreco tp) { using (var context = new WebServiceDBContext()) { foreach (Product p in tp.producs) { context.Produtcs.Attach(p); context.Entry(p).State = System.Data.Entity.EntityState.Unchanged; } context.TabelaPrecos.Add(tp); context.SaveChanges(); } }