@page "/surveys"
@using HyperCube.Models
@attribute [Authorize]
Surveys
EvenID |
ID |
Name |
Description |
DateCreated |
DateUpdated |
CreatorID |
@foreach (var survey in _surveys)
{
@survey.Value.EvenID |
@survey.Value.ID |
@survey.Value.Name |
@survey.Value.Description |
@survey.Value.DateCreated |
@survey.Value.DateUpdated |
@survey.Value.CreatorID |
}
@code {
Dictionary _surveys = new();
protected override async Task OnInitializedAsync()
{
Survey survey;
var surveys = await MySQLConnector.Instance().SQLSelectComplex($"SELECT * FROM surveys WHERE deleted<>1");
if (surveys.Count > 0)
{
foreach (var s in surveys)
{
survey = new()
{
EvenID = Convert.ToInt32(s["eventid"]),
ID = Convert.ToInt32(s["id"]),
Name = Convert.ToString(s["name"]),
Description = Convert.ToString(s["description"]),
DateCreated = Convert.ToDateTime(s["date_created"]),
DateUpdated = Convert.ToDateTime(s["date_updated"]),
CreatorID = Convert.ToString(s["creatorid"])
};
//Console.WriteLine($"add survey. id: {survey.ID}, name: {survey.Name}");
_surveys.Add(survey.ID, survey);
}
}
}
}