예제 #1
0
        public async Task LoadOptions(IEnumerable <StandardDetailResponse> standards)
        {
            var standardsWithOptions = standards.Where(s => s.Options != null && s.Options.Any());
            IEnumerable <StandardOption> optionsToInsert = new List <StandardOption>();

            foreach (var standard in standardsWithOptions)
            {
                // Union to ensure no duplicates.
                optionsToInsert = optionsToInsert.Union(standard.Options.Select(s => new StandardOption {
                    StandardUId = standard.StandardUId, OptionName = s
                }));
            }

            await standardRepository.InsertOptions(optionsToInsert);
        }