public List <TqPathwayAssessment> GetPathwayAssessmentsDataToProcess(List <TqRegistrationPathway> pathwayRegistrations, bool seedPathwayAssessmentsAsActive = true, bool isHistorical = false, bool isBulkUpload = true)
        {
            var tqPathwayAssessments = new List <TqPathwayAssessment>();

            foreach (var(pathwayRegistration, index) in pathwayRegistrations.Select((value, i) => (value, i)))
            {
                if (isHistorical)
                {
                    // Historical record
                    var pathwayAssessment = new TqPathwayAssessmentBuilder().Build(pathwayRegistration, AssessmentSeries[index], isBulkUpload);
                    pathwayAssessment.IsOptedin = false;
                    pathwayAssessment.EndDate   = DateTime.UtcNow.AddDays(-1);

                    var tqPathwayAssessmentHistorical = PathwayAssessmentDataProvider.CreateTqPathwayAssessment(DbContext, pathwayAssessment);
                    tqPathwayAssessments.Add(tqPathwayAssessmentHistorical);
                }

                var activePathwayAssessment = new TqPathwayAssessmentBuilder().Build(pathwayRegistration, AssessmentSeries[index], isBulkUpload);
                var tqPathwayAssessment     = PathwayAssessmentDataProvider.CreateTqPathwayAssessment(DbContext, activePathwayAssessment);
                if (!seedPathwayAssessmentsAsActive)
                {
                    tqPathwayAssessment.IsOptedin = pathwayRegistration.Status == RegistrationPathwayStatus.Withdrawn ? true : false;
                    tqPathwayAssessment.EndDate   = DateTime.UtcNow;
                }

                tqPathwayAssessments.Add(tqPathwayAssessment);
            }
            return(tqPathwayAssessments);
        }
        public TqPathwayAssessment SeedPathwayAssessmentData(TqRegistrationProfile registrationProfile)
        {
            var pathwayAssessment   = new TqPathwayAssessmentBuilder().Build(registrationProfile.TqRegistrationPathways.First());
            var tqPathwayAssessment = PathwayAssessmentDataProvider.CreateTqPathwayAssessment(DbContext, pathwayAssessment);

            DbContext.SaveChanges();
            return(tqPathwayAssessment);
        }
        public static TqPathwayAssessment CreateTqPathwayAssessment(ResultsAndCertificationDbContext _dbContext, bool addToDbContext = true)
        {
            var pathwayAssessment = new TqPathwayAssessmentBuilder().Build();

            if (addToDbContext)
            {
                _dbContext.Add(pathwayAssessment);
            }
            return(pathwayAssessment);
        }
        public List <TqPathwayAssessment> GetPathwayAssessmentsDataToProcess(List <TqRegistrationPathway> registrationPathways)
        {
            var tqPathwayAssessments = new List <TqPathwayAssessment>();

            foreach (var(registrationPathway, index) in registrationPathways.Select((value, i) => (value, i)))
            {
                var pathwayAssessment   = new TqPathwayAssessmentBuilder().Build(registrationPathway, AssessmentSeries[index]);
                var tqPathwayAssessment = PathwayAssessmentDataProvider.CreateTqPathwayAssessment(DbContext, pathwayAssessment);
                tqPathwayAssessments.Add(tqPathwayAssessment);
            }
            return(tqPathwayAssessments);
        }