Beispiel #1
0
        /// <summary>
        /// 修改数据。必须传入Id
        /// </summary>
        public BaseResult UptUser(TestTableParam param)
        {
            if (param.Id == null)
            {
                return(new BaseResult(false, null, Msg.ParamError));
            }
            var model = new TestTable();

            if (param.Name != null)
            {
                model.Name = param.Name;
            }
            if (param.IDNumber != null)
            {
                model.IDNumber = param.IDNumber;
            }
            if (param.MobilePhone != null)
            {
                model.MobilePhone = param.MobilePhone;
            }
            var count = TestTableRepository.Update(model, d => d.Id == param.Id);

            //更新缓存
            TestTableCache.DelUserModel(param.Id.Value);
            return(new BaseResult(true));
        }
Beispiel #2
0
        /// <summary>
        /// 删除数据。必须传入Id
        /// </summary>
        public BaseResult DelUser(TestTableParam param)
        {
            if (param.Id == null)
            {
                return(new BaseResult(false, null, Msg.ParamError));
            }
            var count = TestTableRepository.Delete(param.Id);

            //更新缓存
            TestTableCache.DelUserModel(param.Id.Value);
            return(new BaseResult(count > 0, count, count > 0 ? "" : Msg.Line0));
        }