public override void Update(EmployeeClassification classification)
 {
     using (var context = new OrmCookbook())
     {
         context.Entry(classification).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
コード例 #2
0
 public virtual int Create(EmployeeClassification classification)
 {
     using (var context = new OrmCookbook())
     {
         context.EmployeeClassifications.Add(classification);
         context.SaveChanges();
         return(classification.EmployeeClassificationKey);
     }
 }
コード例 #3
0
 public virtual void Update(EmployeeClassification classification)
 {
     using (var context = new OrmCookbook())
     {
         var temp = context.EmployeeClassifications.Find(classification.EmployeeClassificationKey);
         temp.EmployeeClassificationName = classification.EmployeeClassificationName;
         context.SaveChanges();
     }
 }
コード例 #4
0
        public void Update(Department department)
        {
            department.DivisionKey = department.Division.DivisionKey;

            using (var context = new OrmCookbook())
            {
                context.Entry(department).State = EntityState.Modified;
                context.SaveChanges();
            }
        }
コード例 #5
0
 public int Create(Department department)
 {
     using (var context = new OrmCookbook())
     {
         context.Departments.Add(department);
         context.Entry(department.Division).State = EntityState.Unchanged;
         context.SaveChanges();
         return(department.DepartmentKey);
     }
 }
コード例 #6
0
 public void Delete(Department department)
 {
     using (var context = new OrmCookbook())
     {
         var temp = context.Departments.Find(department.DepartmentKey);
         if (temp != null)
         {
             context.Departments.Remove(temp);
             context.SaveChanges();
         }
     }
 }
コード例 #7
0
 public virtual void Delete(EmployeeClassification classification)
 {
     using (var context = new OrmCookbook())
     {
         var temp = context.EmployeeClassifications.Find(classification.EmployeeClassificationKey);
         if (temp != null)
         {
             context.EmployeeClassifications.Remove(temp);
             context.SaveChanges();
         }
     }
 }