Engage.Survey.Entities.SurveyRepository.LoadSurveys C# (CSharp) Method

LoadSurveys() public method

Loads all the surveys for a particular module instance.
public LoadSurveys ( int moduleId, bool getOutdatedSurveys ) : IQueryable
moduleId int The ID of the module by which surveys should be filtered.
getOutdatedSurveys bool Whether to retrieve surveys whose or is out of range for the current date
return IQueryable
        public IQueryable<Survey> LoadSurveys(int moduleId, bool getOutdatedSurveys)
        {
            var surveys = this.Context.Surveys.Where(survey => survey.ModuleId == moduleId);

            if (!getOutdatedSurveys)
            {
                surveys = from survey in surveys
                          where (survey.StartDate == null || survey.StartDate <= DateTime.Now)
                             && (survey.EndDate == null || survey.EndDate > DateTime.Now)
                          select survey;
            }

            return surveys;
        }