예제 #1
0
        private IEnumerable <CEPSchoolOptionsModel> GetCepSchoolOptions()
        {
            var options             = (CEPSchoolOption[])Enum.GetValues(typeof(CEPSchoolOption));
            var hasProvisionSchools = _repository.GetList <AdmSitesOption>(w => w.IsProvisionSite);

            //TODO: I am not really sure we need such complex method to generate options
            foreach (var option in options)
            {
                if (option == CEPSchoolOption.District)
                {
                    if (!hasProvisionSchools.Any())
                    {
                        yield return(GetCepSchoolOption(option));
                    }
                }
                else
                {
                    yield return(GetCepSchoolOption(option));
                }
            }
        }