Advertisement
Charlos

Adding a Customers Page

Aug 22nd, 2016
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 0.64 KB | None | 0 0
  1. Adding a Customers Page
  2. In the "DemoWebPages" folder, create a new CSHTML file named "Products.cshtml".
  3.  
  4. Replace the code in the file with the code from the example below:
  5. Products.cshtml
  6.  
  7. @{
  8. var db = Database.Open("SmallBakery");
  9. var selectQueryString = "SELECT * FROM Product ORDER BY Name";
  10. }
  11. <html>
  12. <body>
  13. <h1>Small Bakery Products</h1>
  14. <table>
  15. <tr>
  16. <th>Id</th>
  17. <th>Product</th>
  18. <th>Description</th>
  19. <th>Price</th>
  20. </tr>
  21. @foreach(var row in db.Query(selectQueryString))
  22. {
  23. <tr>
  24. <td>@row.Id</td>
  25. <td>@row.Name</td>
  26. <td>@row.Description</td>
  27. <td align="right">@row.Price</td>
  28. </tr>
  29. }
  30. </table>
  31. </body>
  32. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement