public void GetItemByIdTest() { string name = "currency"; string version = "1.0.0"; string id = "1"; var a = service.GetItemAsync(name, version, id); string json = JsonConvert.SerializeObject(a, Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); }
public async Task <HttpResponseMessage> GetDictionaryItemById(string dictionaryName, string version, string id) { _logger.Info( $"DictionaryController.GetDictionaryItemById [ClientAddress: {GetClientAddress()}, DictionaryName: {dictionaryName}, Version: {version}, Id: {id}]"); try { var res = await _service.GetItemAsync(dictionaryName, version, id); if (res == null) { Request.CreateResponse(HttpStatusCode.BadRequest, (Item)null); } return(Request.CreateResponse(HttpStatusCode.OK, res)); } catch (Exception ex) { _logger.Error(GetErrorMessage(ex)); return(Request.CreateResponse(HttpStatusCode.InternalServerError, GetErrorMessage(ex))); } }