<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<WebMvc.ViewData.ModelViewData>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	新闻列表
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>新闻列表</h2>

    <div style="text-align: left">
        
            <table cellspacing="0" cellpadding="5" width="559" border="0" class="grid">
                <tr  >
                    <th width="60">
                        编号
                    </th>
                    <th>
                        标题
                    </th>
                    <th width="150">
                        时间
                    </th>
                    <th width="50">
                        编辑
                    </th>
                    <th width="50">
                        删除
                    </th>
                </tr>
                <!--普通产品展示-->
                <% foreach (var item in Model.News)
                   {                                                                                         
                %>
                <tr>
                    <td align="center">
                        <%=item.NewsId%>
                    </td>
                    <td  align="left" >
                        <a href='/News/Details/<%=item.NewsId %>' target="_blank">
                            <%=item.Heading%>
                        </a>
                    </td>
                     <td align="right">                      
                        <%= Html.Encode(String.Format("{0:g}", item.IssueDate))%>
                    </td>
                     <td align="center">
                        <%= Html.ActionLink("编辑", "Edit", new { id = item.NewsId })%>
                    </td>
                     <td align="center">
                        <%= Html.ActionLink("删除", "Delete", new { id = item.NewsId })%>
                    </td>
                </tr>
                <% } %>
            </table>
            
            <!--分页导航-->
            <table width="100%" height="28" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td align="left" valign="middle" > 
                    ○ 页次：<%= ViewData.Model.CurrentPage%>/<%= ViewData.Model.TotalPages%> 页                        
                    </td>
                    <td align="right" valign="middle" >
                    <% if (ViewData.Model.HasPreviousPage)
                           { %>
                        <%=Html.ActionLink("第一页", "List", new { page = 1 }, null)%>
                        <%=Html.ActionLink("上一页", "List", new { page = ViewData.Model.CurrentPage - 1 }, null)%>
                        <% }
                           else
                           { %>
                           第一页 上一页
                        <% } %>
                       
                        <% if (ViewData.Model.HasNextPage)
                           { %>
                        <%=Html.ActionLink("下一页", "List", new { page = ViewData.Model.CurrentPage + 1 }, null)%>
                        <%=Html.ActionLink("最后页", "List", new { page = ViewData.Model.TotalPages }, null)%>
                        <% }
                           else
                           { %>
                           下一页 最后页
                        <% } %>
                    </td>
                </tr>
            </table>            
            <!--分页导航end-->
            
        </div>

    <p>
        <%= Html.ActionLink("增加", "Create") %>
    </p>

</asp:Content>

