public async Task <ReportServer> Add(Server server, ulong channelId) { ReportServer reportServer = await reportServerRepository.Add(server, channelId); this.Added?.Invoke(this, reportServer); return(reportServer); }
public async Task Remove(ReportServer reportServer) { using (var conn = new MySqlConnection(this.connectionString)) { await conn.OpenAsync(); using (var cmd = new MySqlCommand($@"DELETE FROM report_servers WHERE server_id = @sid AND channel_id = @cid", conn)) { cmd.Parameters.AddWithValue("sid", reportServer.Server.Id); cmd.Parameters.AddWithValue("cid", reportServer.ChannelId); int rows = await cmd.ExecuteNonQueryAsync(); if (rows == 0) { throw new Exception("No rows deleted"); } } } }
public async Task Remove(ReportServer reportServer) { await reportServerRepository.Remove(reportServer); this.Removed?.Invoke(this, reportServer); }