public override void Update(EmployeeClassification classification) { using (var context = new OrmCookbook()) { context.Entry(classification).State = EntityState.Modified; context.SaveChanges(); } }
public virtual int Create(EmployeeClassification classification) { using (var context = new OrmCookbook()) { context.EmployeeClassifications.Add(classification); context.SaveChanges(); return(classification.EmployeeClassificationKey); } }
public virtual void Update(EmployeeClassification classification) { using (var context = new OrmCookbook()) { var temp = context.EmployeeClassifications.Find(classification.EmployeeClassificationKey); temp.EmployeeClassificationName = classification.EmployeeClassificationName; context.SaveChanges(); } }
public void Update(Department department) { department.DivisionKey = department.Division.DivisionKey; using (var context = new OrmCookbook()) { context.Entry(department).State = EntityState.Modified; context.SaveChanges(); } }
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); } }
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(); } } }
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(); } } }