IList <EmployeeModel> IEmployeeService.UpdateEmployee(EmployeeModel employee) { var emp = GetEmployeeContext().SingleOrDefault(e => e.EmployeeId == employee.EmployeeId); if (emp != null) { return(new List <EmployeeModel>()); } emp.DOB = employee.DOB; emp.Email = employee.Email; emp.Phone = employee.Phone; emp.Country = employee.Country; emp.LastName = employee.LastName; emp.FirstName = employee.FirstName; emp.Department = employee.Department; emp.ProfileUrl = employee.ProfileUrl; emp.EmployeeId = employee.EmployeeId; Employeemodel.Add(emp); return(Employeemodel); }
IList <EmployeeModel> IEmployeeService.CreateEmployee(EmployeeModel employee) { try { var emp = new EmployeeModel { DOB = employee.DOB, Email = employee.Email, Phone = employee.Phone, Country = employee.Country, LastName = employee.LastName, FirstName = employee.FirstName, Department = employee.Department, ProfileUrl = employee.ProfileUrl, EmployeeId = employee.EmployeeId }; Employeemodel.Add(emp); return(Employeemodel); } catch (Exception e) { throw e.InnerException; } }