public bool InsertEmployee(EmployeeSalary employeeSalary) { using (var db = new HRServiceContext()) { db.Employees.Add(MapToEmployee(employeeSalary)); db.SaveChanges(); return true; } }
private Employee MapToEmployee(EmployeeSalary employeeSalary) { return new Employee { EmployeeId = employeeSalary.EmployeeId, EmailAddress = employeeSalary.EmailAddress, FirstName = employeeSalary.FirstName, LastName = employeeSalary.LastName, SupervisorId = employeeSalary.SupervisorId, Salary = new Salary { SalaryValue = employeeSalary.Salary } }; }
public virtual void TestSetup() { Service = new HRService(); FakeEmployeeSalary = new EmployeeSalary() { EmailAddress = "*****@*****.**", EmployeeId = 1, FirstName = "asd", LastName = "asd", SupervisorId = null, Salary = 2000 }; FakeEmployee = new Employee() { EmailAddress = "*****@*****.**", EmployeeId = 1, FirstName = "asd", LastName = "asd", SupervisorId = null }; FakeEmployeeList = new List<EmployeeSalary> { FakeEmployeeSalary, new EmployeeSalary() { EmailAddress = "*****@*****.**", EmployeeId = 2, FirstName = "asd1", LastName = "asd1", SupervisorId = 1, Salary = 3000 } }; FakeSalary = new Salary() { EmployeeId = 1, SalaryValue = 2000 }; FakeSalary = new Salary() { EmployeeId = 2, SalaryValue = 3000 }; }
public bool CallInsertEmployee(EmployeeSalary product) { return _client.InsertEmployee(product); }