public Domain.Entities.ApprenticeshipUpdate MapApprenticeshipUpdate(Types.Apprenticeship.ApprenticeshipUpdate update) { var result = new Domain.Entities.ApprenticeshipUpdate { Id = update.Id, ApprenticeshipId = update.ApprenticeshipId, Originator = (Originator)update.Originator, FirstName = update.FirstName, LastName = update.LastName, DateOfBirth = update.DateOfBirth, TrainingCode = update.TrainingCode, TrainingType = update.TrainingType.HasValue ? (TrainingType)update.TrainingType : default(TrainingType?), TrainingName = update.TrainingName, Cost = update.Cost, StartDate = update.StartDate, EndDate = update.EndDate, UpdateOrigin = (UpdateOrigin)update.UpdateOrigin, EffectiveFromDate = update.EffectiveFromDate, EffectiveToDate = null, ULN = update.ULN, ProviderRef = update.ProviderRef, EmployerRef = update.EmployerRef }; // Update the effective from date if they've made a change to the Start Date value - can only be done when waiting to start. if (update.StartDate.HasValue) { result.EffectiveFromDate = update.StartDate.Value; } return(result); }
public Types.Apprenticeship.ApprenticeshipUpdate MapApprenticeshipUpdate(Domain.Entities.ApprenticeshipUpdate data) { if (data == null) { return(null); } return(new Types.Apprenticeship.ApprenticeshipUpdate { Id = data.Id, ApprenticeshipId = data.ApprenticeshipId, Originator = (Types.Apprenticeship.Types.Originator)data.Originator, FirstName = data.FirstName, LastName = data.LastName, DateOfBirth = data.DateOfBirth, TrainingCode = data.TrainingCode, TrainingType = data.TrainingType.HasValue ? (Types.Apprenticeship.Types.TrainingType)data.TrainingType : default(Types.Apprenticeship.Types.TrainingType?), TrainingName = data.TrainingName, Cost = data.Cost, StartDate = data.StartDate, EndDate = data.EndDate }); }