Example #1
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        /// <param name="userService"></param>
        /// <param name="groupService"></param>
        /// <param name="appInfoService"></param>
        /// <returns></returns>
        public static async Task Initialize(IUserService userService, IGroupService groupService, IAppInfoService appInfoService)
        {
            if (await userService.UserExistsAsync("9527"))
            {
                return;
            }
            long userId = await userService.AddNewAsync("9527", "周星星", "123");

            long userId2 = await userService.AddNewAsync("9528", "杨幂", "123");

            long userId3 = await userService.AddNewAsync("9529", "科比", "123");

            long groupId = await groupService.AddNewAsync("演员");

            long groupId2 = await groupService.AddNewAsync("导演");

            long groupId3 = await groupService.AddNewAsync("编剧");

            long groupId4 = await groupService.AddNewAsync("监制");

            await groupService.AddUserToGroupAsync(groupId, userId);

            await groupService.AddUserToGroupAsync(groupId2, userId);

            await groupService.AddUserToGroupAsync(groupId3, userId);

            await groupService.AddUserToGroupAsync(groupId4, userId);

            await groupService.AddUserToGroupAsync(groupId, userId2);

            await groupService.AddUserToGroupAsync(groupId3, userId3);

            await appInfoService.AddNewAsync("测试 Key", "test");
        }
        public static async Task Initialize(IUserService userService, IGroupService groupService, IAppInfoService appInfoService)
        {
            if (await userService.UserExistsAsync("13057686866"))
            {
                return;
            }
            long userId = await userService.AddNewAsync("13057686866", "周星星", "123456");

            long userId2 = await userService.AddNewAsync("13057686867", "周润发", "123456");

            long userId3 = await userService.AddNewAsync("13057686868", "周杰伦", "123456");

            long groupId = await groupService.AddNewAsync("演员");

            long groupId2 = await groupService.AddNewAsync("导演");

            long groupId3 = await groupService.AddNewAsync("编剧");

            long groupId4 = await groupService.AddNewAsync("监制");

            long groupId5 = await groupService.AddNewAsync("歌手");

            await groupService.AddUserToGroupAsync(groupId, userId);

            await groupService.AddUserToGroupAsync(groupId2, userId);

            await groupService.AddUserToGroupAsync(groupId3, userId);

            await groupService.AddUserToGroupAsync(groupId4, userId);

            await groupService.AddUserToGroupAsync(groupId, userId2);

            await groupService.AddUserToGroupAsync(groupId5, userId3);

            await appInfoService.AddNewAsync("测试 Key", "testKey00000000");
        }