排球积分程序(六)——View的编码

Index视图

@{
    ViewBag.Title = "选择功能";
}

<h2>选择功能</h2>
<p>
    @Html.ActionLink("计分", "Count")

    @Html.ActionLink("查询", "Search")
</p>

Count视图

@model MvcVolleyball.Models.Team
@{
    ViewBag.Title = "选择队伍";
}
@using (Html.BeginForm("Count","Volleyball",FormMethod.Post)) {
    @Html.ValidationSummary(true)
    
<div class="editor-label">
            @Html.LabelFor(model => model.teamId, "选择主队")
        </div>
        <div class="editor-field">
            @Html.DropDownList("teamId", String.Empty)
            @Html.ValidationMessageFor(model => model.teamId)
        </div>
    <div class="editor-label">
            @Html.LabelFor(model => model.teamId, "选择客队")
        </div>
        <div class="editor-field">
            @Html.DropDownList("teamId", String.Empty)
            @Html.ValidationMessageFor(model => model.teamId)
        </div>
  <p>
         <input type="submit" value="确定" />
        </p>
}

CountScore视图

@{
    ViewBag.Title = "计分程序";
}

<h2>计分</h2>
<table><tr><td>主队:@ViewBag.hostteam</td>
    
<td>客队:@ViewBag.guestteam</td></tr>
<tr><td>         
           主队得分队员:@Html.DropDownList("hostMember" )              
    </td>
    <td>客队得分队员:@Html.DropDownList("guestMember" )</td>
    
</tr>
    <tr><td>@Html.ActionLink("主队加分", "addScore", new {teamIds=ViewBag.teamId})</td>

        <td>@Html.ActionLink("客队加分", "addScore", new {teamIds=ViewBag.teamId})</td>
    </tr>
    <tr>
        <td>
              主队得分: @ViewBag.hostteamscores
        </td>

        <td>
             客队得分:@ViewBag.guestteamscores
        </td>
    </tr>
    </table>


   

Search视图

@model MvcVolleyball.Models.Team
@{
    ViewBag.Title = "选择查询队伍";
}

<h2>SearchTeam</h2>
@using (Html.BeginForm("Search","Volleyball",FormMethod.Post)) {
    @Html.ValidationSummary(true)
    
<div class="editor-label">
            @Html.LabelFor(model => model.teamId, "选择查询队伍")
        </div>
        <div class="editor-field">
            @Html.DropDownList("teamId", String.Empty)
            @Html.ValidationMessageFor(model => model.teamId)
        </div>
  <p>
         <input type="submit" value="确定" />
        </p>
}

TeamScore视图

@model IEnumerable<MvcVolleyball.Models.HostTeamScore>
@{
    ViewBag.Title = "队伍得分";
}

<h2>队伍得分</h2>
<table>
    <tr>
        <th>
           局数
        </th>
        <th>
            队名
        </th>
        <th>
            得分队员
        </th>
        <th>
            得分
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.inningNum)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.team.teamName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.memberId)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.hostTeamScore)
        </td>
        </tr>
}
    </table>

 

posted @ 2017-06-24 19:45  colorful丶  阅读(140)  评论(0编辑  收藏  举报