Esempio n. 1
0
        public OperateResponse UserDetail(SysUserRequest model)
        {
            return(Excute(() =>
            {
                if (!ModelState.IsValid)
                {
                    return Fail(this.ExpendErrors());
                }
                SysUserDoMain datadomain = new SysUserDoMain();

                var data = model.ToEntity();

                var UserModel = datadomain.GetModel(e => e.ID == data.ID);
                if (UserModel == null)
                {
                    //添加
                    data.ModelCreate();
                    data.DepartmentID = 0;
                    datadomain.AddUser(data, -1);
                }
                //else
                //{
                //    data = model.ToEntity(UserModel);
                //    //编辑
                //    data.ModelEdit();
                //    data.DepartmentID = 0;
                //    datadomain.EditUser(data, -1);
                //}

                return Success();
            }));
        }
Esempio n. 2
0
 public OperateResponse EditPassword(SysUserEditPwdRequest model)
 {
     return(Excute(() =>
     {
         var datadomain = new SysUserDoMain();
         var usermodel = datadomain.GetModel(e => e.UserName == model.UserNmae);
         if (usermodel != null)
         {
             datadomain.EditPassword(usermodel.ID, model.NewPwd, usermodel.ID, model.OldPwd);
         }
         return Success();
     }));
 }
Esempio n. 3
0
        public OperateResponse UserDelete(string UserName)
        {
            var datadomain = new SysUserDoMain();
            var data       = datadomain.GetModel(e => e.UserName == UserName);

            if (data == null)
            {
                return(Fail("未找到这条数据!"));
            }

            Expression <Func <SysUser, bool> > where = e => e.UserName == UserName;
            int flag = datadomain.DelBy(where);

            return(Success());
        }