Beispiel #1
0
        public void AddItemTest()
        {
            string name    = "currency";
            string version = "1.0.0";
            //string id = "1";
            string value = @"{
                              
                              'c1': 'UAH',
                              'c2': 'гривня'
                          }";

            var json = JObject.Parse(value);
            var item = service.AddItemAsync(name, version, json);
        }
        public async Task <HttpResponseMessage> PostItem(string dictionaryName, string version, JObject value)
        {
            _logger.Info(
                $"DictionaryController.PostItem [ClientAddress: {GetClientAddress()}, DictionaryName: {dictionaryName}, Version: {version}]");

            try
            {
                var res = await _service.AddItemAsync(dictionaryName, version, value);

                return(Request.CreateResponse(HttpStatusCode.OK, res));
            }
            catch (Exception ex)
            {
                _logger.Error(GetErrorMessage(ex));

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