Exemple #1
0
        private static void UpdateDepartment(ContosoUniversityEntities db)
        {
            var dept = db.Department.Find(InsertedId);

            dept.Name = "John";
            db.SaveChanges();
        }
Exemple #2
0
        public static void InsertDepartment(ContosoUniversityEntities db)
        {
            var dept = new Department()
            {
                Name      = "Will",
                Budget    = 100,
                StartDate = DateTime.Now
            };

            db.Department.Add(dept);
            db.SaveChanges();

            InsertedId = dept.DepartmentID;
        }
Exemple #3
0
 private static void RemoveDepartment(ContosoUniversityEntities db)
 {
     db.Department.Remove(db.Department.Find(InsertedId));
     db.SaveChanges();
 }