コード例 #1
0
ファイル: EmployeeDao.cs プロジェクト: SGStoyanov/SoftUni
 private static Employee GetEmployeeById(SoftUniEntities entity, int employeeId)
 {
     var employeeById = entity.Employees.FirstOrDefault(e => e.EmployeeID == employeeId);
     return employeeById;
 }
コード例 #2
0
ファイル: EmployeeDao.cs プロジェクト: SGStoyanov/SoftUni
 // Problem 6
 public static void UpdateTwoEmployeesSimulteniously(
     int firstEmployeeId,
     decimal firstSalary,
     int secondEmployeeId,
     decimal secondSalary)
 {
     var firstEmployee = GetEmployeeById(SoftUniContext, firstEmployeeId);
     firstEmployee.Salary = firstSalary;
     var softUniContext2 = new SoftUniEntities();
     var secondEmployee = GetEmployeeById(softUniContext2, secondEmployeeId);
     secondEmployee.Salary = secondSalary;
     SoftUniContext.SaveChanges();
     softUniContext2.SaveChanges();
 }