Example #1
0
 private static Employee GetEmployeeById(SoftUniEntities entity, int employeeId)
 {
     var employeeById = entity.Employees.FirstOrDefault(e => e.EmployeeID == employeeId);
     return employeeById;
 }
Example #2
0
 // 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();
 }