Example #1
0
        /// <summary>
        /// 修改用户
        /// </summary>
        /// <param name="dto">传入用户信息</param>
        public void ModifyUser(UserManage.UserDto dto)
        {
            User entity = _userRepository.Get(dto.Id);

            entity.Email    = dto.Email;
            entity.RealName = dto.RealName;
            entity.Phone    = dto.Phone;
            entity.RoleId   = dto.RoleId;
            _userRepository.Update(entity);
        }
Example #2
0
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="dto">传入用户信息</param>
        public void AddUser(UserManage.UserDto dto)
        {
            #region 业务验证
            User user = _userRepository.Get(t => t.LoginId == dto.Name);
            if (user != null)
            {
                throw new LsException(string.Format("用户名[{0}]已经存在,请确认!", dto.Name));
            }
            #endregion

            User entity = dto.ToEntity <User>();
            entity.Role = _roleRepository.Get(dto.RoleId);
            entity.InitPassword();
            _userRepository.Add(entity);
        }
Example #3
0
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="dto">传入用户信息</param>
        public void DeleteUser(UserManage.UserDto dto)
        {
            User entity = _userRepository.Get(dto.Id);

            _userRepository.Delete(entity);
        }