Beispiel #1
0
 public void GetDictionaryByNameAndVersionTest()
 {
     string name    = "currency";
     string version = "1.0.0";
     var    a       = service.GetDictionaryAsync(name, version, true);
     string json    = JsonConvert.SerializeObject(a, Formatting.Indented,
                                                  new JsonSerializerSettings
     {
         ReferenceLoopHandling = ReferenceLoopHandling.Ignore
     });
 }
        public async Task <HttpResponseMessage> GetDictionaryByNameAndVersion(string dictionaryName, string version)
        {
            _logger.Info(
                $"DictionaryController.GetDictionaryByNameAndVersion [ClientAddress: {GetClientAddress()}, DictionaryName: {dictionaryName}, Version: {version}]");
            try
            {
                var res = await _service.GetDictionaryAsync(dictionaryName, version, true);

                return(Request.CreateResponse(res == null ? HttpStatusCode.NoContent : HttpStatusCode.OK, res));
            }
            catch (Exception ex)
            {
                _logger.Error(GetErrorMessage(ex));

                return(Request.CreateResponse(HttpStatusCode.InternalServerError, GetErrorMessage(ex)));
            }
        }