Exemple #1
0
        private void button6_Click(object sender, EventArgs e)
        {
            Category category = new Category
            {
                Code    = "DD2",
                DelFlag = false,
                Name    = "Deneme Kategori"
            };

            DocsEntities docsEntities = new DocsEntities();

            //Category add = docsEntities.Categories.Add(category);
            docsEntities.Entry(category).State = EntityState.Added;

            docsEntities.SaveChanges();
        }
Exemple #2
0
        private void button8_Click(object sender, EventArgs e)
        {
            DocsEntities docsEntities = new DocsEntities();

            Category category = new Category
            {
                Id      = 1004,
                Code    = "BG2",
                DelFlag = false,
                Name    = "Blgi Yönetim Sistemi"
            };

            //Category category = docsEntities.Categories.FirstOrDefault(c => c.Id == 1003);

            docsEntities.Entry(category).State = EntityState.Deleted;
            docsEntities.SaveChanges();
        }
Exemple #3
0
        private void button7_Click(object sender, EventArgs e)
        {
            DocsEntities docsEntities = new DocsEntities();
            //Category category = docsEntities.Categories.FirstOrDefault(c => c.Id == 1003);

            //category.Name = "Bilgi Güvenliği";
            //category.Code = "BG";

            Category category = new Category
            {
                Id      = 1003,
                Code    = "BG2",
                DelFlag = false,
                Name    = "Blgi Yönetim Sistemi"
            };

            docsEntities.Entry(category).State = EntityState.Modified;

            docsEntities.SaveChanges();
        }