Below is my code:
@{
Layout = "/_SiteLayout.cshtml";
var db = Database.Open("MyDatabase");
var query = "SELECT * FROM Team";
var Teams = db.Query(query);
}
<form>
<table>
<tr>
<td>Team Name</td>
<td>Played</td>
<td>Points</td>
</tr>
@{ foreach(var Team in Teams){
<tr>
<td>@Team.TeamName</td>
<td><input type="text" value="@Team.Played" name="Played"/></td>
<td><input type="text" value="@Team.Points" name="Points"/></td>
</tr>
}
}
</table>
</form>
This is the result:
So what I want to do is update my whole table.
What is the SQL query to do this? I want to update Points
and Games Played
in my database for all teams once the form is posted.