MVC项目实践(六)——UI页面的实现

2021-07-14 23:07

阅读:351

标签:game   hidden   大致   put   create   script   ati   sage   tail   

上篇给出了一个首页:

 1 @model VolleyballScoring.Models.Team
 2 
 3 @{
 4     ViewBag.Title = "Index";
 5 }
 6 
 7 

Index

8

选择你想要进行的事情

9
@Html.ActionLink("查询","Index","Teams")
10
@Html.ActionLink("计分台","Scoring")
11
@Html.ActionLink("观看比赛","Index","Audience")

第一个是跳转查询页面

@model IEnumerable

@{
    ViewBag.Title = "Index";
}

Index

@Html.ActionLink("Create New", "Create")

@foreach (var item in Model) { }
@Html.DisplayNameFor(model => model.Name)
@Html.DisplayFor(modelItem => item.Name) @Html.ActionLink("Edit", "Edit", new { id=item.TId }) | @Html.ActionLink("Details", "Details", new { id=item.TId }) | @Html.ActionLink("Delete", "Delete", new { id=item.TId })|
@Html.ActionLink("Game-Index","Index","Games")

计分台的第一个页面是选择队伍

@model IEnumerable

@{
    ViewBag.Title = "Index";
}

Index

@Html.ActionLink("Create New", "Create")

@foreach (var item in Model) { }
@Html.DisplayNameFor(model => model.TIdA) @Html.DisplayNameFor(model => model.TIdB) @Html.DisplayNameFor(model => model.SscoA) @Html.DisplayNameFor(model => model.SscoB)
@Html.DisplayFor(modelItem => item.TIdA) @Html.DisplayFor(modelItem => item.TIdB) @Html.DisplayFor(modelItem => item.SscoA) @Html.DisplayFor(modelItem => item.SscoB) @Html.ActionLink("Edit", "Edit", new { id=item.GId }) | @Html.ActionLink("Details", "Details", new { id=item.GId }) | @Html.ActionLink("Delete", "Delete", new { id=item.GId })

在选择队伍之后是主要计分页面

 1 @model VolleyballScoring.Models.Section
 2 
 3 @{
 4     ViewBag.Title = "Create";
 5 }
 6 
 7 

Create

8 9 @using (Html.BeginForm()) { 10 @Html.ValidationSummary(true) 11 12
13 Section 14 15
class="editor-label"> 16 @Html.LabelFor(model => model.GId) 17
18
class="editor-field"> 19 @Html.EditorFor(model => model.GId) 20 @Html.ValidationMessageFor(model => model.GId) 21
22 23
class="editor-label"> 24 @Html.LabelFor(model => model.SNum) 25
26
class="editor-field"> 27 @Html.EditorFor(model => model.SNum) 28 @Html.ValidationMessageFor(model => model.SNum) 29
30 31
class="editor-label"> 32 @Html.LabelFor(model => model.RouA) 33
34
class="editor-field"> 35 @Html.EditorFor(model => model.RouA) 36 @Html.ValidationMessageFor(model => model.RouA) 37
38 39
class="editor-label"> 40 @Html.LabelFor(model => model.RouB) 41
42
class="editor-field"> 43 @Html.EditorFor(model => model.RouB) 44 @Html.ValidationMessageFor(model => model.RouB) 45
46 47

48 "submit" value="Create" /> 49

50
51 } 52 53
54 @Html.ActionLink("Back to List", "Index") 55
56 57 @section Scripts { 58 @Scripts.Render("~/bundles/jqueryval") 59 }

最后的表现给观众的详情页面

 1 @model VolleyballScoring.Models.Section
 2 
 3 @{
 4     ViewBag.Title = "Edit";
 5 }
 6 
 7 

Edit

8 9 @using (Html.BeginForm()) { 10 @Html.ValidationSummary(true) 11 12
13 Section 14 15 @Html.HiddenFor(model => model.SId) 16 17
class="editor-label"> 18 @Html.LabelFor(model => model.GId) 19
20
class="editor-field"> 21 @Html.EditorFor(model => model.GId) 22 @Html.ValidationMessageFor(model => model.GId) 23
24 25
class="editor-label"> 26 @Html.LabelFor(model => model.SNum) 27
28
class="editor-field"> 29 @Html.EditorFor(model => model.SNum) 30 @Html.ValidationMessageFor(model => model.SNum) 31
32 33
class="editor-label"> 34 @Html.LabelFor(model => model.RouA) 35
36
class="editor-field"> 37 @Html.EditorFor(model => model.RouA) 38 @Html.ValidationMessageFor(model => model.RouA) 39
40 41
class="editor-label"> 42 @Html.LabelFor(model => model.RouB) 43
44
class="editor-field"> 45 @Html.EditorFor(model => model.RouB) 46 @Html.ValidationMessageFor(model => model.RouB) 47
48 49

50 "submit" value="Save" /> 51

52
53 } 54 55
56 @Html.ActionLink("Back to List", "Index") 57
58 59 @section Scripts { 60 @Scripts.Render("~/bundles/jqueryval") 61 }

以上就是主要页面的实现,大致功能已经实现。接下来是测试运行。

MVC项目实践(六)——UI页面的实现

标签:game   hidden   大致   put   create   script   ati   sage   tail   

原文地址:http://www.cnblogs.com/hutengqi/p/7074403.html


评论


亲,登录后才可以留言!