Пример #1
0
        public Task <bool> Delete(UsermodeLookup lookup)
        {
            return(Task.Run(async() =>
            {
                var total_modified = 0;
                var usermodes = (await Lookup(lookup)).ToList();
                foreach (var usermode in usermodes)
                {
                    if (usermode.Id < 0)
                    {
                        total_modified++;
                        DeleteTemporaryUsermode(usermode.Id);
                    }
                    else
                    {
                        peerChatDb.Remove <UsermodeRecord>(usermode);
                        total_modified += await peerChatDb.SaveChangesAsync();
                    }

                    await ResyncChannelUsermodes(usermode.channelmask);
                }

                SendBansUpdate(usermodes, false);
                return usermodes.Count > 0 && total_modified > 0;
            }));
        }
 public Task <bool> Delete(GlobalOpersLookup lookup)
 {
     return(Task.Run(async() =>
     {
         var users = (await Lookup(lookup)).ToList();
         foreach (var user in users)
         {
             peerChatDb.Remove <GlobalOpersRecord>(user);
         }
         var num_modified = await peerChatDb.SaveChangesAsync();
         return users.Count > 0 && num_modified > 0;
     }));
 }