コード例 #1
0
        /// <summary>
        /// 新增数据。必须传入姓名Name,手机号MobilePhone,身份证号IDNumber
        /// </summary>
        public BaseResult AddUser(TestTableParam param)
        {
            if (string.IsNullOrWhiteSpace(param.Name) || string.IsNullOrWhiteSpace(param.MobilePhone) ||
                string.IsNullOrWhiteSpace(param.IDNumber))
            {
                return(new BaseResult(false, null, Msg.ParamError));
            }
            var model = new TestTable1
            {
                Id          = Guid.NewGuid(),
                Name        = param.Name,
                IDNumber    = param.IDNumber,
                MobilePhone = param.MobilePhone,
                CreateTime  = DateTime.Now,
                T2          = 0,
                T3          = 0,
                T4          = true,
                T7          = 0,
                T9          = 0
            };
            var count = TestTableRepository.Insert(model);

            //设置缓存
            TestTableCache.SetUserModel(model);
            return(new BaseResult(count > 0, count, count > 0 ? "" : Msg.Line0));
        }
コード例 #2
0
ファイル: CommentService.cs プロジェクト: Layofhan/LayForBlog
        public DataResult LoadComment(int nums = 1)
        {
            Blog_TestTable n = new Blog_TestTable();

            n.Name     = "s";
            n.PassWord = "******";
            TestTableRepository.Insert(n);
            var list = TestTable.ToList();

            return(DataProcess.Success(list));
        }