Ejemplo n.º 1
0
        public async Task CreateGroup(ClientIdentity clientIdentity, string groupName,
                                      IReadOnlyList <string> memberIdList)
        {
            Console.WriteLine("---------------- CreateGroup ----------------");
            Console.WriteLine("Client: {0}", clientIdentity.ToString());

            var groupIdentity = new GroupIdentity()
            {
                GroupId   = Guid.NewGuid().ToString("N"),
                GroupName = groupName,
                OwnerId   = clientIdentity.ClientId
            };

            foreach (var memberId in memberIdList)
            {
                await Groups.AddToGroupAsync(memberId, groupIdentity.GroupId);
            }
            await Clients.Clients(memberIdList).SendAsync(HubConstant.NotifyAddedToGroupMethod,
                                                          groupIdentity, clientIdentity);

            groupLookup.Add(groupIdentity);
        }
Ejemplo n.º 2
0
 internal Group(SPAccess SPAccess, global::SPAccess.GroupIdentity groupIdentity)
     : base(SPAccess)
 {
     this.groupIdentity = groupIdentity;
 }
        public async Task SetGroupIdentityAsync(int courseID, int groupID, string userID, GroupIdentity identity)
        {
            try
            {
                var ug = await this.GetUserGroupAsync(groupID, userID, courseID);

                if (ug == null)
                {
                    throw new Exception("User-Group Not Valid!");
                }
                ug.Identity = identity;
                dbContext.UserGroup.Update(ug);
                await dbContext.SaveChangesAsync();
            }
            catch (Exception e)
            {
                logger.LogError(e.Message);
                throw new Exception("Action Failed!");
            }
        }