public static EmployeeModel toModel(Employee entity) { EmployeeModel model = new EmployeeModel(); if (entity != null) { model.token = entity.token; model.FirstName = entity.FirstName; model.LastName = entity.LastName; model.JobTitle = entity.JobTitle; model.MailingAddress = entity.MailingAddress; model.company = CompanyMapper.toModel(entity.company); model.department = DepartmentMapper.toModel(entity.department); } return(model); }
public static Employee toEntity(Employee entity, EmployeeModel model) { if (model != null) { entity.token = model.token; entity.FirstName = model.FirstName; entity.LastName = model.LastName; entity.JobTitle = model.JobTitle; entity.MailingAddress = model.MailingAddress; entity.departmentToken = model.department.token; entity.department = DepartmentMapper.toEntity(new Department(), model.department); entity.companyToken = model.company.token; entity.company = CompanyMapper.toEntity(new Company(), model.company); } return(entity); }