コード例 #1
0
        public virtual IActionResult GetCompetencyDefinition([FromRoute] string sourceId)
        {
            CompetencyDefinitionData data = new CompetencyDefinitionData(_connectionString);

            if (!sourceId.Contains('.'))
            {
                return(new BadRequestResult());
            }

            string[] sourceValues           = sourceId.Split('.');
            CompetencyDefinitionType result = null;

            switch (sourceValues[0])
            {
            case "SLO":
                SLO value = data.GetLearningOutcome(sourceId);

                if (value != null)
                {
                    result = CompetencyDefinitionSetMapper.Map(value);
                }
                break;
            }

            if (result == null)
            {
                return(new NotFoundObjectResult(sourceId));
            }

            return(new ObjectResult(result.ToJson()));
        }
コード例 #2
0
        public virtual IActionResult GetAllCompetencyDefinitions([FromQuery] int?limit, [FromQuery] int?offset, [FromQuery] string filter)
        {
            CompetencyDefinitionData data = new CompetencyDefinitionData(_connectionString);
            List <SLO> values             = data.GetLearningOutcomes(limit ?? 100, offset ?? 0);

            var example = CompetencyDefinitionSetMapper.Map(values).ToJson();

            if (example == null)
            {
                return(new NotFoundResult());
            }

            return(new ObjectResult(example));
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CompetencyContextSetType" /> class.
        /// </summary>
        /// <param name="input">List of programs serving as competency contexts</param>
        /// <returns></returns>
        public static CompetencyContextType Map(Credential input)
        {
            CompetencyContextType def = new CompetencyContextType(Guid.NewGuid(), input.org_name)
            {
                ContextId            = string.Format("CREDENTIAL.{0}", input.credential_id),
                ContextEffectiveDate = input.lst_mod_dt,
                ContextLabel         = input.org_name,
                ContextTitle         = input.credential_name,
                ContextType          = "CREDENTIAL"
            };

            if (input.sloes != null)
            {
                def.CompetencyList = new List <CompetencyDefinitionType>();

                foreach (SLO s in input.sloes)
                {
                    def.CompetencyList.Add(CompetencyDefinitionSetMapper.Map(s));
                }
            }

            return(def);
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CompetencyContextSetType" /> class.
        /// </summary>
        /// <param name="inputs">List of programs serving as competency contexts</param>
        /// <returns></returns>
        public static CompetencyContextType Map(Organization input)
        {
            CompetencyContextType def = new CompetencyContextType(Guid.NewGuid(), input.name)
            {
                ContextId            = string.Format("ORGANIZATION.{0}", input.org_entity_id),
                ContextEffectiveDate = input.lst_mod_dt,
                ContextLabel         = input.org_type_name,
                ContextTitle         = string.IsNullOrEmpty(input.mission) ? input.description : input.description,
                ContextType          = "ORGANIZATION"
            };

            if (input.sloes != null)
            {
                def.CompetencyList = new List <CompetencyDefinitionType>();

                foreach (SLO s in input.sloes)
                {
                    def.CompetencyList.Add(CompetencyDefinitionSetMapper.Map(s));
                }
            }

            return(def);
        }