Esempio n. 1
0
        /// <summary>
        /// Gets the contents of a code list
        /// </summary>
        /// <param name="name">The name of the code list to get</param>
        /// <param name="codelistSource">
        /// Where to get the code list from, if not set the following search order will be used:
        /// 1. Service
        /// 2. Service owner
        /// </param>
        /// <returns>The requested code list if found</returns>
        public string GetCodelist(string name, CodeListSourceType codelistSource = CodeListSourceType.Unspecified)
        {
            switch (codelistSource)
            {
            case CodeListSourceType.Service:
            {
                return(_execution.GetCodelist(Org, Service, name));
            }

            case CodeListSourceType.Owner:
            {
                return(_execution.GetCodelist(Org, null, name));
            }

            case CodeListSourceType.Platform:
            {
                throw new NotImplementedException();
            }

            default:
            {
                string codelist = _execution.GetCodelist(Org, Service, name);
                if (!string.IsNullOrEmpty(codelist))
                {
                    return(codelist);
                }

                codelist = _execution.GetCodelist(Org, Service, name);
                if (!string.IsNullOrEmpty(codelist))
                {
                    return(codelist);
                }

                codelist = _execution.GetCodelist(Org, null, name);
                if (!string.IsNullOrEmpty(codelist))
                {
                    return(codelist);
                }

                return(null);
            }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Returns
        /// </summary>
        /// <param name="org"></param>
        /// <param name="service"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public IActionResult Index(string org, string service, string name)
        {
            string codelist = _execution.GetCodelist(org, service, name);

            if (string.IsNullOrEmpty(codelist))
            {
                return(Json("{}"));
            }

            return(Content(codelist));
        }