Exemplo n.º 1
0
 public void AddProduct(Product newProduct)
 {
     using (var db = new WorkDbContext())
     {
         db.ProductTabel.Add(newProduct);
         db.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void CreateStockTask(StockTask newItem)
 {
     using (var db = new WorkDbContext())
     {
         db.StockItemTable.Add(newItem);
         db.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void AddDay(WorkDay newDay)
 {
     using (var db = new WorkDbContext())
     {
         db.WorkDayTable.Add(newDay);
         db.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public void DeleteProduct(int id)
 {
     using (var db = new WorkDbContext())
     {
         var product = db.ProductTabel.Find(id);
         db.ProductTabel.Remove(product);
         db.SaveChanges();
     }
 }
Exemplo n.º 5
0
 public void DeleteWorkDay(int id)
 {
     using (var db = new WorkDbContext())
     {
         var day = db.WorkDayTable.Find(id);
         db.WorkDayTable.Remove(day);
         db.SaveChanges();
     }
 }
Exemplo n.º 6
0
 public void DeleteStockTask(int id)
 {
     using (var db = new WorkDbContext())
     {
         var task = db.StockItemTable.Find(id);
         db.StockItemTable.Remove(task);
         db.SaveChanges();
     }
 }
Exemplo n.º 7
0
 public void EditProduct(Product updatedProduct)
 {
     using (var db = new WorkDbContext())
     {
         db.ProductTabel.Attach(updatedProduct);
         var entry = db.Entry(updatedProduct);
         entry.State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Exemplo n.º 8
0
 public void EditWorkDay(WorkDay dayEdit)
 {
     using (var db = new WorkDbContext())
     {
         db.WorkDayTable.Attach(dayEdit);
         var entry = db.Entry(dayEdit);
         entry.State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Exemplo n.º 9
0
 public void UpdateStockTask(StockTask updatedTask)
 {
     using (var db = new WorkDbContext())
     {
         db.StockItemTable.Attach(updatedTask);
         var entry = db.Entry(updatedTask);
         entry.State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }