public async Task <bool> SaveGroupUser(IUser tEntity, long userId) { if (tEntity.RoleId == 1) { foreach (var user in tEntity.GroupUsers) { IGroupUser groupUser = user; groupUser.UserId = userId; groupUser.GroupId = user.Id; var savedUser = await this._groupUserRepository.AddNew(user); } } return(true); }
public async Task <IGroupUser> AddNew(IGroupUser entity) { try { this.StartTransaction(); var savedEntity = await base.AddNew(entity as TGroupUser); this.CommitTransaction(); return(savedEntity); } catch (PostgresException ex) { throw new EntityUpdateException(ex); } catch { throw; } }
public async Task WarnUser(IGroupUser user) { var userAccount = UserAccounts.getAccount((SocketUser)user); userAccount.NumberOfWarnings++; UserAccounts.SaveAccounts(); //punishiment check if (userAccount.NumberOfWarnings >= 3) { //await user.Guild.AddBanAsync(user, 5); } else if (userAccount.NumberOfWarnings >= 2) { await Context.Channel.SendMessageAsync("You received more than 2 warning! If you recive more than 3 warnings you could be banned!"); } else if (userAccount.NumberOfWarnings >= 1) { await Context.Channel.SendMessageAsync("You received your first warning! If you recive more than 3 warnings you could be banned!"); } }
public GroupUserEvent(IGroupUser iGroupUser) { _IGroupUser = iGroupUser; }
public GroupUserController(IGroupUser repo, IGroup groupRepository) { repository = repo; groupRepo = groupRepository; }
public GroupController(IGroup groupRepository, IEvent eventRepository, IGroupUser groupUser) { repository = groupRepository; eventRepo = eventRepository; guRepo = groupUser; }
public DbGroupRepo(GatheringDbContext context, IConfiguration configuration, IGroupUser groupUserRepo) { _context = context; Configuration = configuration; guRepo = groupUserRepo; }