public ContractBO Create(ContractBO bo) { using (var unitOfWork = _uow) { var convertedEntity = _converter.Convert(bo); var createdEntity = unitOfWork.ContractRepository.Create(convertedEntity); unitOfWork.Complete(); return(_converter.Convert(createdEntity)); } }
public List <ContractGridBO> GetAll() { var contractGridBOs = new List <ContractGridBO>(); using (var unitOfWork = _uow) { var contracts = unitOfWork.ContractRepository.GetAll(); foreach (var contract in contracts) { var project = _projectConverter.Convert(unitOfWork.ProjectRepository.Get(contract.ProjectId)); var newContractGridBO = new ContractGridBO { Contract = _contractConverter.Convert(contract), Project = project, Company = _companyConverter.Convert(unitOfWork.CompanyRepository.Get(contract.CompanyId)) }; if (project.WantedSupervisorId != null) { newContractGridBO.WantedSupervisor = _supervisorConverter.Convert(unitOfWork.SupervisorRepository.Get((int)project.WantedSupervisorId)); } if (project.AssignedSupervisorId != null) { newContractGridBO.AssignedSupervisor = _supervisorConverter.Convert(unitOfWork.SupervisorRepository.Get((int)project.AssignedSupervisorId)); } contractGridBOs.Add(newContractGridBO); } unitOfWork.Complete(); return(contractGridBOs); } }
public void ConvertEntity() { var bo = _converter.Convert(MockContract); Assert.NotNull(bo); }