public async Task <ActionResult> LearningStandards(LearningStandardsViewModel model)
        {
            var learningStandardsModel = new LearningStandardsModel
            {
                ApiKey    = model.ApiKey,
                ApiSecret = model.ApiSecret
            };

            var result = await _learningStandardsValidator.ValidateAsync(learningStandardsModel);

            if (!result.IsValid)
            {
                var errorMessages = result.Errors.Select(x => new { x.ErrorMessage });
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return(JsonResult(new { Result = new { Errors = errorMessages } }));
            }

            await _learningStandardsSetupCommand.Execute(
                new AcademicBenchmarkConfig
            {
                ApiKey     = model.ApiKey,
                ApiSecret  = model.ApiSecret,
                OdsApiMode = CloudOdsAdminAppSettings.Instance.Mode
            });

            await RunLearningStandardsJob();

            return(Ok());
        }
コード例 #2
0
        public async Task <ActionResult> LearningStandards(LearningStandardsModel model)
        {
            await _learningStandardsSetupCommand.Execute(
                new AcademicBenchmarkConfig
            {
                ApiKey     = model.ApiKey,
                ApiSecret  = model.ApiSecret,
                OdsApiMode = CloudOdsAdminAppSettings.Instance.Mode
            });

            await RunLearningStandardsJob();

            return(Ok());
        }