public IActionResult GetNameValueReferenceData(string appGroupName, string appItemName)
        {
            using (loggingHelper.RMTraceManager.StartTrace("WebService.GetNameValueReferenceData"))
            {
                string methodName = MethodBase.GetCurrentMethod().Name;
                loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.ReferenceDataAPIPriority, LoggerTraceConstants.ReferenceDataControllerMethodEntryEventId, LoggerTraceConstants.Title);

                if (string.IsNullOrEmpty(appGroupName) || string.IsNullOrEmpty(appItemName))
                {
                    return(BadRequest());
                }

                var nameValuePairsObject = referenceDataBusinessService.GetReferenceDataByNameValuePairs(appGroupName, appItemName);

                Tuple <string, NameValuePair> nameValueSingleResource = new Tuple <string, NameValuePair>(NameValuePair, nameValuePairsObject);

                if (nameValuePairsObject == null)
                {
                    throw new BusinessLogicException(ErrorConstants.Err_MisMatchConfigFile, HttpStatusCode.ExpectationFailed);
                }

                loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.ReferenceDataAPIPriority, LoggerTraceConstants.ReferenceDataControllerMethodExitEventId, LoggerTraceConstants.Title);

                return(Ok(nameValueSingleResource));
            }
        }
示例#2
0
        public void Test_GetReferenceDataByNameValuePairs()
        {
            var result = testCandidate.GetReferenceDataByNameValuePairs("AccessLinkStatus", "AccessLinkParameters");

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Name, "key");
            Assert.AreEqual(result.Value, "value");
        }