public async Task <ActionResult> ApplicationList(int pageNumber) { var edOrgs = (await _odsApiFacadeFactory.Create()) .GetAllEducationOrganizations(_mapper); var vendorsIndexModel = new VendorApplicationsIndexModel { Vendors = Page <VendorApplicationsModel> .Fetch(VendorsApplicationsModel, pageNumber) }; return(PartialView("_Applications", vendorsIndexModel)); List <VendorApplicationsModel> VendorsApplicationsModel(int offset, int limit) { var vendors = _getVendorsQuery.Execute(offset, limit).ToList(); var vendorsApplicationsModel = _mapper.Map <List <VendorApplicationsModel> >( vendors, opts => opts.WithEducationOrganizations(edOrgs)); if (CloudOdsAdminAppSettings.Instance.Mode.SupportsMultipleInstances) { foreach (var model in vendorsApplicationsModel) { FilterInstanceSpecificApplications(model); } } return(vendorsApplicationsModel); } }
public async Task <ActionResult> DescriptorCategoryList() { var model = new DescriptorCategoriesModel { DescriptorCategories = (await _odsApiFacadeFactory.Create()).GetAllDescriptors() }; return(PartialView("_DescriptorCategories", model)); }
public async Task <ActionResult> AddLocalEducationAgency(AddLocalEducationAgencyModel viewModel) { var model = _mapper.Map <LocalEducationAgency>(viewModel); model.Id = Guid.Empty.ToString(); var addResult = (await _odsApiFacadeFactory.Create()).AddLocalEducationAgency(model); return(addResult.Success ? JsonSuccess("Organization Added") : JsonError(addResult.ErrorMessage)); }
public async Task <ActionResult> DescriptorCategoryList() { var descriptorCategoryPaths = (await _odsApiFacadeFactory.Create()).GetAllDescriptors(); var model = new DescriptorCategoriesModel { DescriptorCategories = descriptorCategoryPaths.Select(path => new DescriptorCategoriesModel.Category { Path = path, Name = path.GetDescriptorCategoryName() }).OrderBy(x => x.Name).ToList() }; return(PartialView("_DescriptorCategories", model)); }
public async Task <ActionResult> Index() { var odsApiFacade = await _odsApiFacadeFactory.Create(); var config = await _odsSecretConfigurationProvider.GetSecretConfiguration(_instanceContext.Id); if (config == null) { _logger.Error("ODS secret configuration is null."); throw new InvalidOperationException("ODS secret configuration can not be null."); } var model = new LearningStandardsIndexModel { OdsInstanceSettingsTabEnumerations = _tabDisplayService.GetOdsInstanceSettingsTabDisplay(OdsInstanceSettingsTabEnumeration .LearningStandards), LearningStandardsModel = new LearningStandardsModel { ApiKey = config.LearningStandardsCredential?.ApiKey ?? string.Empty, ApiSecret = config.LearningStandardsCredential?.ApiSecret ?? string.Empty, HasApiData = odsApiFacade.DoesApiDataExist(), SynchronizationWasSuccessful = config.LearningStandardsCredential?.SynchronizationWasSuccessful ?? false, IsJobRunning = _learningStandardsJob.IsJobRunning(), IsSameOdsInstance = _learningStandardsJob.IsSameOdsInstance(_instanceContext.Id, typeof(LearningStandardsJobContext)), LastUpdatedDate = config.LearningStandardsCredential?.LastUpdatedDate ?? DateTime.MinValue }, OdsInstance = _instanceContext }; ViewData["PathBase"] = Request != null?Request.PathBase.ToString() : ""; return(View(model)); }
public async Task <ActionResult> ApplicationList() { var vendors = _getVendorsQuery.Execute().Where(v => !v.IsSystemReservedVendor()).ToList(); var edOrgs = (await _odsApiFacadeFactory.Create(CloudOdsEnvironment.Production)) .GetAllEducationOrganizations(_mapper); var vendorsApplicationsModel = _mapper.Map <List <VendorApplicationsModel> >( vendors, opts => opts.WithEducationOrganizations(edOrgs)); if (CloudOdsAdminAppSettings.Instance.Mode.SupportsMultipleInstances) { foreach (var model in vendorsApplicationsModel) { FilterInstanceSpecificApplications(model); } } return(PartialView("_Applications", vendorsApplicationsModel)); }
private async Task WarmupApiServer(CloudOdsEnvironment environment) { _logger.Info($"Setup: Warming up {environment.DisplayName} API"); try { (await _odsApiFacadeFactory.Create(environment)).WarmUp(); } catch (Exception ex) { _logger.Error($"Setup: {environment.DisplayName} API Warmup Failed", ex); } }
private async Task WarmupApiServer() { _logger.Info("Setup: Warming up API"); try { (await _odsApiFacadeFactory.Create()).WarmUp(); } catch (Exception ex) { _logger.Error("Setup: API Warmup Failed", ex); } }
public async Task <ActionResult> Add(int vendorId) { var vendor = _getVendorByIdQuery.Execute(vendorId); var apiFacade = await _odsApiFacadeFactory.Create(); var leas = apiFacade.GetAllLocalEducationAgencies().ToList(); var schools = apiFacade.GetAllSchools().ToList(); var profiles = _mapper.Map <List <ProfileModel> >(_getProfilesQuery.Execute()); var model = new AddApplicationViewModel { VendorId = vendorId, VendorName = vendor.VendorName, Environment = CloudOdsEnvironment.Production, LocalEducationAgencies = leas, Schools = schools, ClaimSetNames = GetClaimSetNames(), Profiles = profiles }; return(PartialView("_AddApplicationModal", model)); }
public AddLocalEducationAgencyModelValidator(IOdsApiFacadeFactory odsApiFacadeFactory) { _apiFacade = odsApiFacadeFactory.Create().GetAwaiter().GetResult(); RuleFor(m => m.LocalEducationAgencyId).NotEmpty(); RuleFor(m => m.Name).NotEmpty(); RuleFor(m => m.StreetNumberName).NotEmpty(); RuleFor(m => m.State).NotEmpty(); RuleFor(m => m.City).NotEmpty(); RuleFor(m => m.ZipCode).NotEmpty(); RuleFor(m => m.LocalEducationAgencyId) .Must(BeUniqueId).When(m => m.LocalEducationAgencyId != null) .WithMessage("This 'Local Education Organization ID' is already associated with another Education Organization. Please provide a unique value."); }
public AddSchoolModelValidator(IOdsApiFacadeFactory odsApiFacadeFactory) { _apiFacade = odsApiFacadeFactory.Create().GetAwaiter().GetResult(); RuleFor(x => x.SchoolId).NotEmpty(); RuleFor(x => x.Name).NotEmpty(); RuleFor(x => x.StreetNumberName).NotEmpty(); RuleFor(x => x.City).NotEmpty(); RuleFor(x => x.State).NotEmpty(); RuleFor(x => x.ZipCode).NotEmpty(); RuleFor(x => x.GradeLevels).Must(x => x != null && x.Count > 0).WithMessage("You must choose at least one grade level"); RuleFor(x => x.SchoolId) .Must(BeUniqueId).When(x => x.SchoolId != null) .WithMessage("This 'School ID' is already associated with another Education Organization. Please provide a unique value."); }
public async Task <ActionResult> AddLocalEducationAgency(AddLocalEducationAgencyModel viewModel) { var apiFacade = await _odsApiFacadeFactory.Create(); var leaId = viewModel.LocalEducationAgencyId; if (leaId != null) { if (ProposedEducationOrganizationIdIsInUse(leaId.Value, apiFacade)) { return(ValidationFailureResult( "LocalEducationAgencyId", "This 'Local Education Organization ID' is already associated with " + "another Education Organization. Please provide a unique value.")); } } var model = _mapper.Map <LocalEducationAgency>(viewModel); model.Id = Guid.Empty.ToString(); var addResult = apiFacade.AddLocalEducationAgency(model); return(addResult.Success ? JsonSuccess("Organization Added") : JsonError(addResult.ErrorMessage)); }
public async Task <ActionResult> AddLocalEducationAgencyModal() { var api = await _odsApiFacadeFactory.Create(); var localEducationAgencyCategoryOptions = api.GetLocalEducationAgencyCategories(); var stateOptions = api.GetAllStateAbbreviations(); var requiredApiDataExist = (await _odsApiFacadeFactory.Create()).DoesApiDataExist(); var model = new AddLocalEducationAgencyModel { LocalEducationAgencyCategoryTypeOptions = localEducationAgencyCategoryOptions, StateOptions = stateOptions, RequiredApiDataExist = requiredApiDataExist }; if (CloudOdsAdminAppSettings.Instance.Mode == ApiMode.DistrictSpecific) { model.LocalEducationAgencyId = OdsInstanceIdentityHelper.GetIdentityValue(_instanceContext.Name); } return(PartialView("_AddLocalEducationAgencyModal", model)); }