示例#1
0
        public async Task <ActionResult <Rule> > Post(Rule rule)
        {
            var rules = (await _cache.CacheGetListAsync <Rule>("Rules")).ToList();

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

            return(CreatedAtAction(nameof(Get), new { id = rule.Id }, rule));
        }