public async Task CreateFromItemsAsync(EnglishTaskFromItemsCreateModel createModel)
        {
            var taskItems = await _taskItemRepository
                            .FindAllAsync(x => createModel.Items.Contains(x.Id));

            var taskContent = taskItems
                              .Select(x => x.Content)
                              .ToBsonArray();

            var englishTask = new EnglishTask
            {
                GrammarPart  = createModel.GrammarPart,
                TaskType     = createModel.TaskType,
                EnglishLevel = createModel.EnglishLevel,
                Count        = taskItems.Count,
                Content      = taskContent,
            };

            await _englishTaskRepository.AddAsync(englishTask);
        }
Beispiel #2
0
        public async Task CreateEnglishTaskAsync(EnglishTaskCreateModel englishTaskCreateModel)
        {
            var englishTask = _mapper.Map <EnglishTaskCreateModel, EnglishTask>(englishTaskCreateModel);

            await _taskRepository.AddAsync(englishTask);
        }