public async Task AddUserPunishment(ulong userId, Punishment punishment) { if (_punishments.ContainsKey(userId)) { _punishments[userId].Add(punishment); } else { _punishments.Add(userId, new List <Punishment> { punishment }); } var option = (ProtectionPunishmentOption)(int)punishment.PunishmentOption; var protectionPunishment = new ProtectionPunishment(option, userId, punishment.GivenAt, punishment.ForTime); var command = new AddProtectionPunishmentCommand(protectionPunishment); await this._commandBus.ExecuteAsync(command); }
public AddProtectionPunishmentCommand(ProtectionPunishment protectionPunishment) { this.ProtectionPunishment = protectionPunishment; }
public AddProtectionPunishmentCommand(ProtectionPunishmentOption protectionPunishmentOption, ulong userId, DateTime givenAt, TimeSpan?forTime = null) { this.ProtectionPunishment = new ProtectionPunishment(protectionPunishmentOption, userId, givenAt, forTime); }