Exemplo n.º 1
0
        public ActionResult UpdateTestData(long index, string name, int age, string birthday)
        {
            RedisCacheProvider cacheProvider = new RedisCacheProvider();

            //if (string.IsNullOrEmpty(name))
            //{
            //    return Json(new { success = false, message = "請輸入姓名" }, JsonRequestBehavior.AllowGet);
            //}
            //if (!cache.Where(x => x.Name.ToLower() == name.ToLower()).Any())
            //{
            //    return Json(new { success = false, message = "找不到資料" }, JsonRequestBehavior.AllowGet);
            //}
            //var data = cache.Where(x => x.Name.ToLower() == name.ToLower())
            //    .FirstOrDefault();

            cacheProvider.ListUpdate(
                index,
                "VueTest:LoadData:VueTestModel",
                new VueTestModel {
                Name = name, Age = age, Birthday = birthday, Changed = false
            });


            return(Json(new { success = true, message = "更新完成" }, JsonRequestBehavior.AllowGet));
        }