Beispiel #1
0
        public async Task <IActionResult> ImportSkills()
        {
            // This is just temporary for now, until we have a proper skills admin api and UI.
            var model   = new ImportSkillSetViewModel();
            var courses = await _courseService.GetCoursesAsync();

            model.Courses = courses.Select(c => new SelectListItem {
                Text = c.Title, Value = c.Id.ToString()
            }).ToList();
            return(View(model));
        }
Beispiel #2
0
        public async Task <IActionResult> ImportSkills(ImportSkillSetViewModel model)
        {
            if (ModelState.IsValid)
            {
                var failureMessages = await _skillService.ImportSkillsAsync(model.CourseId, model.Description, model.File.OpenReadStream());

                if (failureMessages.Any())
                {
                    model.FailureMessages.AddRange(failureMessages);
                }
                else
                {
                    model.SuccessMessages.Add($"The skill set has been successfully imported.");
                }
            }
            var courses = await _courseService.GetCoursesAsync();

            model.Courses = courses.Select(c => new SelectListItem {
                Text = c.Title, Value = c.Id.ToString()
            }).ToList();
            return(View(model));
        }