diff options
author | Ian C <ianc@noddybox.co.uk> | 2024-03-27 18:58:09 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2024-03-27 18:58:09 +0000 |
commit | 57acc97e1f9d76c2edbb4eeabae4ea3dd635bb77 (patch) | |
tree | 8298ce7c00cc59a87269ba58dcc4ecaa51215470 /Pages | |
parent | fe5c628725260d0bee594108afe0eec1e802e8b2 (diff) |
Updated for new download table format.1.0
Diffstat (limited to 'Pages')
-rw-r--r-- | Pages/Report.cshtml | 16 | ||||
-rw-r--r-- | Pages/Report.cshtml.cs | 7 |
2 files changed, 13 insertions, 10 deletions
diff --git a/Pages/Report.cshtml b/Pages/Report.cshtml index ed7dbfa..624d61f 100644 --- a/Pages/Report.cshtml +++ b/Pages/Report.cshtml @@ -26,18 +26,22 @@ <table style width="100%"> <tr> - <td style="width:25%;"><b>Time</b></td> - <td style="width:25%;"><b>Key</b></td> - <td style="width:25%;"><b>IP Address</b></td> - <td style="width:25%;"><b>User Agent</b></td> + <td style="width:20%;"><b>Time</b></td> + <td style="width:15%;"><b>Key</b></td> + <td style="width:65%;"><b>Info</b></td> </tr> @foreach(Download obj in Model.Rows) { <tr> <td>@obj.Time</td> <td>@obj.Key</td> - <td>@obj.IpAddress</td> - <td>@obj.UserAgent</td> + <td> + @foreach (string s in obj.Info) + { + @s + <br> + } + </td> </tr> } </table>
\ No newline at end of file diff --git a/Pages/Report.cshtml.cs b/Pages/Report.cshtml.cs index 365041f..76cfabf 100644 --- a/Pages/Report.cshtml.cs +++ b/Pages/Report.cshtml.cs @@ -36,17 +36,16 @@ public class ReportModel : PageModel conn.Open(); - using var cmd = new NpgsqlCommand("SELECT key, ip_address, user_agent, time FROM download ORDER BY time", conn); + using var cmd = new NpgsqlCommand("SELECT key, info, time FROM download ORDER BY time", conn); using var reader = cmd.ExecuteReader(); while(reader.Read()) { string key = (string)reader["key"]; - string ip_address = (string)reader["ip_address"]; - string user_agent = (string)reader["user_agent"]; + string[] info = (string[])reader["info"]; DateTime time = (DateTime)reader["time"]; - Rows.Add(new Download(key, ip_address, user_agent, time)); + Rows.Add(new Download(key, info, time)); } } catch(Exception e) |