14 | Enrollment Date 15 | | 16 |17 | Students 18 | | 19 |
---|---|
25 | @Html.DisplayFor(modelItem => item.EnrollmentDate) 26 | | 27 |28 | @item.StudentCount 29 | | 30 |
11 | Create New 12 |
13 |17 | Number 18 | | 19 |20 | Title 21 | | 22 |23 | Credits 24 | | 25 |26 | Department 27 | | 28 |29 | |
---|---|---|---|---|
37 | |
39 |
40 | |
42 |
43 | |
45 |
46 | |
48 | 49 | Edit | 50 | Details | 51 | Delete 52 | | 53 |
11 | Create New 12 |
13 |Name | 17 |Budget | 18 |Start Date | 19 |Administrator | 20 |21 | |
---|---|---|---|---|
29 | @Html.Display(modelItem => modelItem.Data[i].Name) 30 | | 31 |32 | @Html.Display(modelItem => modelItem.Data[i].Budget) 33 | | 34 |35 | @Html.Display(modelItem => modelItem.Data[i].StartDate) 36 | | 37 |38 | @Html.Display(modelItem => modelItem.Data[i].AdministratorFullName) 39 | | 40 |41 | Edit | 42 | Details | 43 | Delete 44 | | 45 |
12 | Request ID: @Model.RequestId
13 |
18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |
20 |21 | The Development environment shouldn't be enabled for deployed applications. 22 | It can result in displaying sensitive information from exceptions to end users. 23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 24 | and restarting the app. 25 |
26 | -------------------------------------------------------------------------------- /ContosoUniversity/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.Mvc.RazorPages; 4 | 5 | namespace ContosoUniversity.Pages; 6 | 7 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 8 | public class ErrorPage : PageModel 9 | { 10 | public string RequestId { get; set; } 11 | 12 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 13 | 14 | public void OnGet() 15 | { 16 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 17 | } 18 | } -------------------------------------------------------------------------------- /ContosoUniversity/Pages/HtmlHelperExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq.Expressions; 4 | using ContosoUniversity.Infrastructure.Tags; 5 | using HtmlTags; 6 | using HtmlTags.Conventions; 7 | using Microsoft.AspNetCore.Mvc.Rendering; 8 | using Microsoft.Extensions.DependencyInjection; 9 | 10 | namespace ContosoUniversity.Pages; 11 | 12 | public static class HtmlHelperExtensions 13 | { 14 | public static HtmlTag DisplayLabel11 | Contoso University is a sample application that 12 | demonstrates how to use Entity Framework Core in an 13 | ASP.NET Core Razor Pages web app. 14 |
15 |22 | You can build the application by following the steps in a series of tutorials. 23 |
24 |25 | See the tutorial 26 |
27 |34 | You can download the completed project from GitHub. 35 |
36 |37 | See project source code 38 |
39 |11 | Create New 12 |
13 |Last Name | 17 |First Name | 18 |Hire Date | 19 |Office | 20 |Courses | 21 |22 | |
---|---|---|---|---|---|
35 | |
37 |
38 | |
40 |
41 | |
43 |
44 | |
46 |
47 | @{
48 | foreach (var course in item.CourseAssignments)
49 | {
50 | @course.CourseId @: @course.CourseTitle 51 | } 52 | } 53 | |
54 | 55 | Select | 56 | Edit | 57 | Details | 58 | Delete 59 | | 60 |
72 | | Number | 73 |Title | 74 |Department | 75 |
---|---|---|---|
86 | Select 87 | | 88 |89 | @item.Id 90 | | 91 |92 | @item.Title 93 | | 94 |95 | @item.DepartmentName 96 | | 97 |
Name | 110 |Grade | 111 |
---|---|
117 | @item.StudentFullName 118 | | 119 |
120 | |
122 |
@ViewData["ErrorMessage"]
10 | 11 |Course Title | 39 |Grade | 40 |
---|---|
45 | |
47 |
48 | |
50 |
11 | Create New 12 |
13 | 14 | 23 | 24 |28 | Last Name 29 | | 30 |31 | First Name 32 | | 33 |34 | Enrollment Date 35 | | 36 |Enrollments Count | 37 |38 | |
---|---|---|---|---|
46 | |
48 |
49 | |
51 |
52 | |
54 |
55 | |
57 | 58 | Edit | 59 | Details | 60 | Delete 61 | | 62 |