Facebook
From Harmless Giraffe, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 69
  1. @page
  2. @model IndexModel
  3. @{
  4.    ViewData["Title"] = "Home page";
  5. }
  6.  
  7. <style>
  8.    th {
  9.       background-color: antiquewhite;
  10.    }
  11.    th, td{
  12.       padding: 10px;
  13.    }
  14. </style>
  15. @using (Html.BeginForm())
  16. {
  17. <div class="text-center">
  18.    <h1 class="display-4">Project 4: Advanced Project</h1>
  19.    <h3>Aurel Villyani</h3>
  20.    @* <button class="btn-primary" type="submit" value="get_instructor_list" asp-page-handler="AccessInstructorList">Get Instructor List</button>*@
  21.    @if (ViewData["showInstructorList"] != null)
  22.    {
  23.       <label for="instructorList">Select an instructor: </label>
  24.       @Html.DropDownList("instructorList", (IEnumerable<SelectListItem>)ViewData["showInstructorList"])
  25.    }
  26.  
  27.    <button asp-page-handler="GetInstructorInfo">Get Instructor Info</button>
  28.    @if (ViewData["showInstructorInformation"] != null)
  29.    {
  30.       var showData = ViewData["showInstructorInformation"] as System.Data.DataTable;
  31.       var students = ViewData["students"] as System.Data.DataTable;
  32.      
  33.       // Get student in course
  34.       //
  35.      
  36.          @foreach (System.Data.DataRow row in showData.Rows)
  37.          {
  38.                 <table>
  39.                     <tr>
  40.                         <th>Course No</th>
  41.                         <th>Course Name</th>
  42.                         <th>Students</th>
  43.                         <th>Section Number</th>
  44.                         <th>Starting Date</th>
  45.                         <th>Location</th>
  46.                         <th>Capacity</th>
  47.                     </tr>
  48.                     <tr>
  49.                         <td>@row["course_id"]</td>
  50.                         <td>@row["course_name"]</td>
  51.                         <td>
  52.                             <table>
  53.                                 <tr>
  54.                                     <th>Student ID</th>
  55.                                     <th>Student Name</th>
  56.                                 </tr>
  57.                                 @foreach (System.Data.DataRow student in students.Rows)
  58.                                 {
  59.                                     if (student["course_id"].Equals(row["course_id"]) && student["section_number"].Equals(row["section_number"]))
  60.                                     {
  61.                                         <tr>
  62.                                             <td>@student["student_id"]</td>
  63.                                             <td>@student["student_name"]</td>
  64.                                         </tr>
  65.                                     }
  66.                                 }
  67.                             </table>
  68.                         </td>
  69.                         <td>@row["section_number"]</td>
  70.                         <td>@row["starting_date"]</td>
  71.                         <td>@row["location"]</td>
  72.                         <td>@row["capacity"]</td>
  73.  
  74.                     </tr>
  75.                 </table>
  76.                
  77.                
  78.          }
  79.    }
  80. </div>
  81. }