Exemple #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()));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CompetencyContextSetType" /> class.
        /// </summary>
        /// <param name="input">Courses serving as competency contexts</param>
        /// <returns></returns>
        public static CompetencyDefinitionType Map(SLO input)
        {
            var contexts = new List <CompetencyDefinitionType>();

            CompetencyDefinitionType def = MapBase(input);

            return(def);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CompetencyContextSetType" /> class.
        /// </summary>
        /// <param name="inputs">List of courses serving as competency contexts</param>
        /// <returns></returns>
        public static CompetencyDefinitionSetType Map(List <SLO> inputs)
        {
            var contexts = new List <CompetencyDefinitionType>();

            foreach (var input in inputs)
            {
                CompetencyDefinitionType def = MapBase(input);

                contexts.Add(def);
            }

            CompetencyDefinitionSetType type = new Models.CompetencyDefinitionSetType(contexts);

            return(type);
        }