public void Create(WorkerDTO item) { var employeeEntity = Database.Employees.Find(item.Employee.Id); var projectEntity = Database.Projects.Find(item.Project.Id); var worker = new ProjectWorkerEntity { EmployeeId = employeeEntity.Id, ProjectId = projectEntity.Id }; worker.FillFieldsOnCreate(); Database.Workers.Create(worker); }
private WorkerDTO CreateWorkerDTO(ProjectWorkerEntity entity) { var employeeEntity = Database.Employees.Find(entity.EmployeeId); //var employeeDTO = EService.CreateEmployeeDTO(employeeEntity); var projectEntity = Database.Projects.Find(entity.ProjectId); //var projectDTO = PService.CreateProjectDTO(projectEntity); var worker = new WorkerDTO { Id = entity.Id, //Employee = employeeDTO, //Project = projectDTO }; return(worker); }