diff --git "a/\347\216\213\351\235\226\350\214\271/20241230-\344\275\277\347\224\250\344\270\213\346\213\211\350\241\250\345\215\225\346\230\276\347\244\272\346\225\260\346\215\256.md" "b/\347\216\213\351\235\226\350\214\271/20241230-\344\275\277\347\224\250\344\270\213\346\213\211\350\241\250\345\215\225\346\230\276\347\244\272\346\225\260\346\215\256.md" new file mode 100644 index 0000000000000000000000000000000000000000..b15e03f7a562c27a3877088395428568bb3fb583 --- /dev/null +++ "b/\347\216\213\351\235\226\350\214\271/20241230-\344\275\277\347\224\250\344\270\213\346\213\211\350\241\250\345\215\225\346\230\276\347\244\272\346\225\260\346\215\256.md" @@ -0,0 +1,33 @@ +## 在下拉表单显示数据(ID数据-->文字显示) + +1. 在action中使用ViewBag传入数据到试图 +```cs +ViewBag.Courses = _db.Courses.ToList(); +ViewBag.Students = _db.Students.ToList(); +``` + +2. 在视图中使用foreach循环接收数据 +```cs + +``` + +# 作业 +## 删除页面中将Id变为名称 +1. 在action中传入数据 +```cs +ViewBag.Students = _db.Students.FirstOrDefault(x=>x.Id == obj.StudentId); +ViewBag.Courses = _db.Courses.FirstOrDefault(x=>x.Id == obj.CourseId); +``` + +2. 在视图中接收 +```cs +
Learn about building Web apps with ASP.NET Core.
+Use this page to detail your site's privacy policy.
diff --git "a/\347\216\213\351\235\226\350\214\271/\346\235\202\344\270\203\346\235\202\345\205\253\344\270\234\350\245\2772/ScoreManger/Views/Scores/Index.cshtml" "b/\347\216\213\351\235\226\350\214\271/\346\235\202\344\270\203\346\235\202\345\205\253\344\270\234\350\245\2772/ScoreManger/Views/Scores/Index.cshtml" new file mode 100644 index 0000000000000000000000000000000000000000..2202c54af77c4d373d202c3ebb19b275fbfbd462 --- /dev/null +++ "b/\347\216\213\351\235\226\350\214\271/\346\235\202\344\270\203\346\235\202\345\205\253\344\270\234\350\245\2772/ScoreManger/Views/Scores/Index.cshtml" @@ -0,0 +1,25 @@ +Id | +课程名称 | +学生名称 | +操作 | +成绩 | +
---|---|---|---|---|
@item.Id | +@item.CourseName | +@item.StudentName | +@item.Scores | ++ 编辑 + 删除 + | +
+ Request ID: @Model.RequestId
+
+ Swapping to Development environment will display more detailed information about the error that occurred. +
++ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +
diff --git "a/\347\216\213\351\235\226\350\214\271/\346\235\202\344\270\203\346\235\202\345\205\253\344\270\234\350\245\2772/ScoreManger/Views/Shared/_Layout.cshtml" "b/\347\216\213\351\235\226\350\214\271/\346\235\202\344\270\203\346\235\202\345\205\253\344\270\234\350\245\2772/ScoreManger/Views/Shared/_Layout.cshtml" new file mode 100644 index 0000000000000000000000000000000000000000..0dde6cccbd75bfc85a72406e46546b7077a1c50d --- /dev/null +++ "b/\347\216\213\351\235\226\350\214\271/\346\235\202\344\270\203\346\235\202\345\205\253\344\270\234\350\245\2772/ScoreManger/Views/Shared/_Layout.cshtml" @@ -0,0 +1,49 @@ + + + + + +`s get reset. However, we also reset the\n// bottom margin to use `rem` units instead of `em`.\n\np {\n margin-top: 0;\n margin-bottom: $paragraph-margin-bottom;\n}\n\n\n// Abbreviations\n//\n// 1. Duplicate behavior to the data-bs-* attribute for our tooltip plugin\n// 2. Add the correct text decoration in Chrome, Edge, Opera, and Safari.\n// 3. Add explicit cursor to indicate changed behavior.\n// 4. Prevent the text-decoration to be skipped.\n\nabbr[title],\nabbr[data-bs-original-title] { // 1\n text-decoration: underline dotted; // 2\n cursor: help; // 3\n text-decoration-skip-ink: none; // 4\n}\n\n\n// Address\n\naddress {\n margin-bottom: 1rem;\n font-style: normal;\n line-height: inherit;\n}\n\n\n// Lists\n\nol,\nul {\n padding-left: 2rem;\n}\n\nol,\nul,\ndl {\n margin-top: 0;\n margin-bottom: 1rem;\n}\n\nol ol,\nul ul,\nol ul,\nul ol {\n margin-bottom: 0;\n}\n\ndt {\n font-weight: $dt-font-weight;\n}\n\n// 1. Undo browser default\n\ndd {\n margin-bottom: .5rem;\n margin-left: 0; // 1\n}\n\n\n// Blockquote\n\nblockquote {\n margin: 0 0 1rem;\n}\n\n\n// Strong\n//\n// Add the correct font weight in Chrome, Edge, and Safari\n\nb,\nstrong {\n font-weight: $font-weight-bolder;\n}\n\n\n// Small\n//\n// Add the correct font size in all browsers\n\nsmall {\n @include font-size($small-font-size);\n}\n\n\n// Mark\n\nmark {\n padding: $mark-padding;\n background-color: $mark-bg;\n}\n\n\n// Sub and Sup\n//\n// Prevent `sub` and `sup` elements from affecting the line height in\n// all browsers.\n\nsub,\nsup {\n position: relative;\n @include font-size($sub-sup-font-size);\n line-height: 0;\n vertical-align: baseline;\n}\n\nsub { bottom: -.25em; }\nsup { top: -.5em; }\n\n\n// Links\n\na {\n color: $link-color;\n text-decoration: $link-decoration;\n\n &:hover {\n color: $link-hover-color;\n text-decoration: $link-hover-decoration;\n }\n}\n\n// And undo these styles for placeholder links/named anchors (without href).\n// It would be more straightforward to just use a[href] in previous block, but that\n// causes specificity issues in many other styles that are too complex to fix.\n// See https://github.com/twbs/bootstrap/issues/19402\n\na:not([href]):not([class]) {\n &,\n &:hover {\n color: inherit;\n text-decoration: none;\n }\n}\n\n\n// Code\n\npre,\ncode,\nkbd,\nsamp {\n font-family: $font-family-code;\n @include font-size(1em); // Correct the odd `em` font sizing in all browsers.\n direction: ltr #{\"/* rtl:ignore */\"};\n unicode-bidi: bidi-override;\n}\n\n// 1. Remove browser default top margin\n// 2. Reset browser default of `1em` to use `rem`s\n// 3. Don't allow content to break outside\n\npre {\n display: block;\n margin-top: 0; // 1\n margin-bottom: 1rem; // 2\n overflow: auto; // 3\n @include font-size($code-font-size);\n color: $pre-color;\n\n // Account for some code outputs that place code tags in pre tags\n code {\n @include font-size(inherit);\n color: inherit;\n word-break: normal;\n }\n}\n\ncode {\n @include font-size($code-font-size);\n color: $code-color;\n word-wrap: break-word;\n\n // Streamline the style when inside anchors to avoid broken underline and more\n a > & {\n color: inherit;\n }\n}\n\nkbd {\n padding: $kbd-padding-y $kbd-padding-x;\n @include font-size($kbd-font-size);\n color: $kbd-color;\n background-color: $kbd-bg;\n @include border-radius($border-radius-sm);\n\n kbd {\n padding: 0;\n @include font-size(1em);\n font-weight: $nested-kbd-font-weight;\n }\n}\n\n\n// Figures\n//\n// Apply a consistent margin strategy (matches our type styles).\n\nfigure {\n margin: 0 0 1rem;\n}\n\n\n// Images and content\n\nimg,\nsvg {\n vertical-align: middle;\n}\n\n\n// Tables\n//\n// Prevent double borders\n\ntable {\n caption-side: bottom;\n border-collapse: collapse;\n}\n\ncaption {\n padding-top: $table-cell-padding-y;\n padding-bottom: $table-cell-padding-y;\n color: $table-caption-color;\n text-align: left;\n}\n\n// 1. Removes font-weight bold by inheriting\n// 2. Matches default `