예제 #1
0
        public async Task <IActionResult> Put(int id, Rule rule)
        {
            if (id != rule.Id)
            {
                return(BadRequest());
            }
            var _rule = await _cache.CacheFindAsync <Rule>("Rules", a => a.Id == id);

            if (_rule == null)
            {
                return(NotFound());
            }
            var rules = await _cache.CacheReplaceAsync <Rule>("Rules", a => a.Id == id, rule);

            await _cache.CacheSaveAsync("Rules", rules.ToArray());

            return(NoContent());
        }