示例#1
0
        public async Task <ActionResult> SetRedisAsync(RedisConfig config, [FromBody] JObject json)
        {
            if (config == RedisConfig.WEB && JOjectValider.IsVaildObject <RedisWeb>(json))
            {
                string key = "web_" + Path.GetRandomFileName();
                DataGateway.Webkeys.Add(key);
                await dataGateway.RedisSetWebAsync(key, rediscacheClient, json.ToObject <RedisWeb>());

                return(Ok("Done"));
            }
            else if (config == RedisConfig.MOBILE && JOjectValider.IsVaildObject <RedisMobile>(json))
            {
                string key = "mobile_" + Path.GetRandomFileName();
                DataGateway.Mobilekeys.Add(key);
                await dataGateway.RedisSetMobileAsync(key, rediscacheClient, json.ToObject <RedisMobile>());

                return(Ok("Done"));
            }

            else
            {
                return(NotFound("Error, not vaild data"));
            }
        }