InspectDatabase.cshtml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. @{
  2. ViewData["Title"] = "Database Inspector";
  3. }
  4. <h2>Database Structure Inspector</h2>
  5. @if (ViewBag.Error != null)
  6. {
  7. <div class="alert alert-danger">
  8. <strong>Error:</strong> @ViewBag.Error
  9. </div>
  10. }
  11. else
  12. {
  13. <h3>Tables in Database:</h3>
  14. @if (ViewBag.Tables != null)
  15. {
  16. <ul>
  17. @foreach (string table in ViewBag.Tables)
  18. {
  19. <li>@table @(table.ToLower().Contains("image") ? " <strong>(IMAGE TABLE FOUND!)</strong>" : "")</li>
  20. }
  21. </ul>
  22. <p><strong>Total tables found:</strong> @ViewBag.Tables.Count</p>
  23. }
  24. <h3>Image Table Status:</h3>
  25. <p><strong>Image table exists:</strong> @ViewBag.ImageTableExists</p>
  26. @if (ViewBag.ImageTableName != null)
  27. {
  28. <p><strong>Image table name:</strong> @ViewBag.ImageTableName</p>
  29. }
  30. @if (ViewBag.ImageTableColumns != null)
  31. {
  32. <h4>Image Table Columns:</h4>
  33. <ul>
  34. @foreach (string column in ViewBag.ImageTableColumns)
  35. {
  36. <li>@column</li>
  37. }
  38. </ul>
  39. @if (ViewBag.ImageRecordCount != null)
  40. {
  41. <p><strong>Sample records found:</strong> @ViewBag.ImageRecordCount</p>
  42. }
  43. }
  44. @if (ViewBag.ImageTableError != null)
  45. {
  46. <div class="alert alert-warning">
  47. <strong>Image Table Error:</strong> @ViewBag.ImageTableError
  48. </div>
  49. }
  50. }
  51. <a href="@Url.Action("Index", "Recipe")" class="btn btn-primary">Back to Recipes</a>