Example #1
0
        public Dictionary <string, object> _add(ActionExecutingContext c)
        {
            var j = bs.reqJson(c.HttpContext.Request); //{"cmps_r":3, "username":"******"}
            var k = bs.reqPath(c.HttpContext.Request); //professor/add

            if (!bs.S <bool>(k))
            {
                bs.S(k, true);
                bs.msg(k + "/cmps_r", (value, rule, arg, safe) => "정수값을 입력하세요.");
                bs.msg(k + "/username", (value, rule, arg, safe) => "잘못된 형식의 이름입니다.");
                bs.vali(k, "cmps_r", "int:" + k + "/cmps_r", "username", "min[1]|max[10]");
            }
            var result = bs.valiResult();

            if (!bs.vali(k).check(out result, bs.json2kv(j, "cmps_r", "username")))
            {
                bs.s("valiError", result);
                return(null);
            }
            else
            {
                return(new Dictionary <string, object>()
                {
                    { "cmps_rowid", result["cmps_r"].value },
                    { "username", result["username"].value }
                });
            }
        }
Example #2
0
        public Dictionary <string, object> _list(ActionExecutingContext c)
        {
            var j = bs.reqJson(c.HttpContext.Request); //{"r":3}
            var k = bs.reqPath(c.HttpContext.Request); //professor/contents/contents/list

            if (!bs.S <bool>(k))
            {
                bs.S(k, true);
                bs.msg(k + "/r", (value, rule, arg, safe) => "정수값을 입력하세요.");
                bs.vali(k, "r", "int:" + k + "/r"); //contree_rowid
            }
            var result = bs.valiResult();

            if (!bs.vali(k).check(out result, bs.json2kv(j, "r")))
            {
                bs.s("valiError", result);
                return(null);
            }
            else
            {
                return(new Dictionary <string, object>()
                {
                    { "contree_rowid", result["r"].value }
                });
            }
        }