Ejemplo n.º 1
0
        /// <summary>
        /// 添加用户组
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <HeaderResult <string> > AddUserGroup(UserGroupDto input)
        {
            var userGroupEntity = new UserGroupInfo().CreateUserGroup(input.UserGroupName, input.CreateUserId, input.CreateUserName);
            await _userGroupRepository.AddEntityAsync(userGroupEntity);

            await _userGroupRepository.CommitAsync();

            HeaderResult <string> result = new HeaderResult <string>
            {
                IsSucceed = true,
                Message   = "添加成功!"
            };

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <returns></returns>
        public async Task <HeaderResult <string> > AddUser(AddUserDto input)
        {
            Address  address = new Address(input.Province, input.City, input.County, input.AddressDetails);
            UserInfo user    = new UserInfo().CreateUser(input.UserName, input.UserPassword, input.UserPhone, address, new Guid(), "管理员");
            await _userRepository.AddEntityAsync(user);

            await _userRepository.CommitAsync();

            var result = new HeaderResult <string>
            {
                IsSucceed = true,
                Message   = "添加成功!"
            };

            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加角色
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <HeaderResult <string> > AddRole(AddRoleDto input)
        {
            var roleInfo = await _roleRepository.LoadEntityMaxSortAsync(e => e.RoleShot);

            var shotIndex = 1;

            if (roleInfo != null)
            {
                shotIndex = roleInfo.RoleShot + 1;
            }
            var userRoleEntity = new RoleInfo().CreateRole(input.RoleName, input.RoleType, input.RoleDescription, shotIndex);
            await _roleRepository.AddEntityAsync(userRoleEntity);

            await _roleRepository.CommitAsync();

            HeaderResult <string> result = new HeaderResult <string>
            {
                IsSucceed = true,
                Message   = "添加成功!"
            };

            return(result);
        }