Employee Information business logic layer

The interface for the Employee Manager class looks like this:

    namespace Applications.BusinessLogic.Managers
{
public interface IEmployeeManager : IBusinessManager
{
int GetTotalNumberOfEmployees();


/// <summary>
/// Adds the new employee into the DB
/// </summary>
/// <returns></returns>
Employee AddNewEmployee(Employee newEmployee);

void RemoveAnEmployee(Employee newEmployee);

/// <summary>
/// Gets the List of All Employees eventually
from data source
/// </summary>
/// <returns></returns>
IEnumerable<Employee> GetListofAllEmployees();

Employee GetAnEmployee(int employeeId);
}
}

Let's look at the implementation code, which is as written as follows:

    public class EmployeeManager : IEmployeeManager
{
private IRepository _employeeRepository;
protected readonly Employee DEFAULT_EMPLOYEE;

public EmployeeManager(IRepository
employeeRepository) : base()
{
_employeeRepository = employeeRepository;
DEFAULT_EMPLOYEE = new Employee { FirstName =
"Not found", FamilyName = "Not found", Employee_ID = 0 };
}

public int GetTotalNumberOfEmployees()
{
return _employeeRepository.GetRecordsCount<Employee>();
}

public Employee AddNewEmployee(Employee newEmployee)
{
_employeeRepository.Create(newEmployee);
return newEmployee;
}

public IEnumerable<Employee> GetListofAllEmployees()
{
return _employeeRepository.GetAll<Employee>();
}

public void RemoveAnEmployee(Employee newEmployee)
{
_employeeRepository.Delete(newEmployee);
}

public Employee GetAnEmployee(int employeeId)
{
var employee = _employeeRepository.GetEntity<Employee>
(employeeId);
if (employee == null) return DEFAULT_EMPLOYEE;
return employee;
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.137.75