Пример #1
0
        public IHttpActionResult Get([FromUri] Input value)
        {
            JObject result = null;

            try
            {
                if (value == null || value.key == null)
                {
                    return(BadRequest());
                }
                else
                {
                    var obj = _keyValueCache.GetValue(value.key);
                    if (obj != null)
                    {
                        result = new JObject(
                            new JProperty("success", true),
                            new JProperty("value", obj.ToString())
                            );
                    }
                    else
                    {
                        result = new JObject(
                            new JProperty("success", false),
                            new JProperty("value", null)
                            );
                    }
                    return(Ok(result));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("CacheController.Get " + ex);
                return(InternalServerError());
            }
        }