Exemple #1
0
        public void Add(TEntity entity)
        {
            entity.IsDeleted  = false;
            entity.AddDate    = DateTime.Now;
            entity.UpdateDate = DateTime.Now;

            dbSet.Add(entity);
            db.SaveChanges();
        }
Exemple #2
0
 //update metodu
 public static void UpdateProduct(Product product)
 {
     using (BilgeAdamContext db = new BilgeAdamContext())
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Exemple #3
0
 public static void UpdateSupplier(Supplier supplier)
 {
     using (BilgeAdamContext db = new BilgeAdamContext())
     {
         db.Entry(supplier).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Exemple #4
0
 //id ye göre HARD silme metodu
 public static void HardDeleteProduct(int id)
 {
     using (BilgeAdamContext db = new BilgeAdamContext())
     {
         Product product = db.Products.FirstOrDefault(q => q.ID == id);
         db.Products.Remove(product);
         db.SaveChanges();
     }
 }
Exemple #5
0
        //idye göre silme
        public static void DeleteProduct(int id)
        {
            using (BilgeAdamContext db = new BilgeAdamContext())
            {
                Product product = db.Products.FirstOrDefault(q => q.ID == id);
                product.IsDeleted  = true;
                product.DeleteDate = DateTime.Now;

                db.SaveChanges();
            }
        }
Exemple #6
0
        public static void DeleteCategory(int id)
        {
            using (BilgeAdamContext db = new BilgeAdamContext())
            {
                Category category = db.Categories.FirstOrDefault(q => q.ID == id);
                category.IsDeleted  = true;
                category.DeleteDate = DateTime.Now;

                db.SaveChanges();
            }
        }
Exemple #7
0
 public static void DeleteSupplier(int id)
 {
     using (BilgeAdamContext db = new BilgeAdamContext())
     {
         Supplier supplier = db.Suppliers.FirstOrDefault(q => q.ID == id);
         if (supplier != null)
         {
             supplier.IsDeleted = true;
             db.SaveChanges();
         }
     }
 }
Exemple #8
0
        public static void AddSupplier(Supplier supplier)
        {
            using (BilgeAdamContext db = new BilgeAdamContext())
            {
                supplier.AddDate    = DateTime.Now;
                supplier.UpdateDate = DateTime.Now;
                supplier.IsDeleted  = false;

                db.Suppliers.Add(supplier);
                db.SaveChanges();
            }
        }
Exemple #9
0
        //public static List<Product> GetAllProducts()
        //{
        //    using (BilgeAdamContext db = new BilgeAdamContext())
        //    {
        //        return db.Products.Where(q => q.IsDeleted == false).ToList();
        //    }
        //}

        public static void AddProduct(Product product)
        {
            using (BilgeAdamContext db = new BilgeAdamContext())
            {
                product.AddDate    = DateTime.Now;
                product.IsDeleted  = false;
                product.UpdateDate = DateTime.Now;

                db.Products.Add(product);

                db.SaveChanges();
            }
        }
Exemple #10
0
        public static void AddCategory(Category category)
        {
            using (BilgeAdamContext db = new BilgeAdamContext())
            {
                category.AddDate    = DateTime.Now;
                category.IsDeleted  = false;
                category.UpdateDate = DateTime.Now;

                db.Categories.Add(category);

                db.SaveChanges();
            }
        }
Exemple #11
0
        public static void AddAdminUser(AdminUser adminuser)
        {
            using (BilgeAdamContext db = new BilgeAdamContext())
            {
                adminuser.InsertedUserID = 1;
                adminuser.UpdatedUserID  = 1;
                adminuser.AddDate        = DateTime.Now;
                adminuser.IsDeleted      = false;
                adminuser.UpdateDate     = DateTime.Now;

                db.AdminUsers.Add(adminuser);

                db.SaveChanges();
            }
        }