Exemple #1
0
 public StockTask GetStockTask(int id)
 {
     using (var db = new WorkDbContext())
     {
         return(db.StockItemTable.Find(id));
     }
 }
Exemple #2
0
 public Product GetProductById(int id)
 {
     using (var db = new WorkDbContext())
     {
         return(db.ProductTabel.Find(id));
     }
 }
Exemple #3
0
 public void AddProduct(Product newProduct)
 {
     using (var db = new WorkDbContext())
     {
         db.ProductTabel.Add(newProduct);
         db.SaveChanges();
     }
 }
Exemple #4
0
 public void CreateStockTask(StockTask newItem)
 {
     using (var db = new WorkDbContext())
     {
         db.StockItemTable.Add(newItem);
         db.SaveChanges();
     }
 }
Exemple #5
0
 public void AddDay(WorkDay newDay)
 {
     using (var db = new WorkDbContext())
     {
         db.WorkDayTable.Add(newDay);
         db.SaveChanges();
     }
 }
Exemple #6
0
 public void DeleteProduct(int id)
 {
     using (var db = new WorkDbContext())
     {
         var product = db.ProductTabel.Find(id);
         db.ProductTabel.Remove(product);
         db.SaveChanges();
     }
 }
Exemple #7
0
 public void DeleteWorkDay(int id)
 {
     using (var db = new WorkDbContext())
     {
         var day = db.WorkDayTable.Find(id);
         db.WorkDayTable.Remove(day);
         db.SaveChanges();
     }
 }
Exemple #8
0
 public void DeleteStockTask(int id)
 {
     using (var db = new WorkDbContext())
     {
         var task = db.StockItemTable.Find(id);
         db.StockItemTable.Remove(task);
         db.SaveChanges();
     }
 }
Exemple #9
0
 public WorkDay GetWorkDay(int id)
 {
     using (var db = new WorkDbContext())
     {
         var workday = db.WorkDayTable.Find(id);
         db.Entry(workday).Collection(day => day.WorkLoad).Load();
         return(workday);
     }
 }
Exemple #10
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();
     }
 }
Exemple #11
0
 public List <Product> GetProductByName(string productName)
 {
     using (var db = new WorkDbContext())
     {
         var foundProduct = from product in db.ProductTabel
                            where product.Name == productName
                            select product;
         return(foundProduct.ToList());
     }
 }
Exemple #12
0
        public List <Product> GetProductAll()
        {
            using (var db = new WorkDbContext())
            {
                var products = from product in db.ProductTabel
                               select product;

                return(products.ToList());
            }
        }
Exemple #13
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();
     }
 }
Exemple #14
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();
     }
 }
Exemple #15
0
        public List <WorkDay> GetWorkHistory()
        {
            using (var db = new WorkDbContext())
            {
                var days = from day in db.WorkDayTable
                           select day;

                return(days.ToList());
            }
        }
Exemple #16
0
        public List <Product> GetProductByCategory(string productCategory)
        {
            if (productCategory == "All")
            {
                var allProducts = GetProductAll();
                return(allProducts);
            }

            using (var db = new WorkDbContext())
            {
                var products = from product in db.ProductTabel
                               where product.Category == productCategory
                               select product;

                return(products.ToList());
            }
        }