コード例 #1
0
ファイル: HomeController.cs プロジェクト: bennyy1256/VueTest
        public ActionResult CreateTestData(string name, int age, string birthday)
        {
            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(birthday) || age == null || age <= 0)
            {
                return(Json(new { success = false, message = "請輸入正確內容" }, JsonRequestBehavior.AllowGet));
            }

            RedisCacheProvider cacheProvider = new RedisCacheProvider();

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

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