<%@ 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 style="font-weight: bold; text-align: center; height: 30px">
                <th width="60">
                    图片
                </th>
                <th>
                    商品名称
                </th>
                <th width="50">
                    价格
                </th>
                <th width="50">
                    编辑
                </th>
                <th width="50">
                    删除
                </th>
            </tr>
            <!--普通产品展示-->
            <% foreach (var item in Model.Products)
               {                                                                                         
            %>
            <tr>
                <td align="center">
                    <a href='/Product/Details/<%=item.ProductId %>' title="产品信息" rel="gb_page_center[700, 530]">
                        <img width="50" height="50" border="0" src='/ProductImages/<%=item.Image %>'>
                    </a>
                </td>
                <td align="left">
                    <a href='/Product/Details/<%=item.ProductId %>' target="_blank"><span class="c001">
                        <%=item.Name%>
                    </span></a>
                </td>
                <td align="right">
                    <%= Html.Encode(String.Format("{0:F}", item.Price)) %>
                </td>
                <td align="center">
                    <%= Html.ActionLink("编辑", "Edit", new { id = item.ProductId })%>
                </td>
                <td align="center">
                    <%= Html.ActionLink("删除", "Delete", new { id = item.ProductId })%>
                </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.PreviousPage }, null)%>
                    <% }
                       else
                       { %>
                    第一页 上一页
                    <% } %>
                    <% if (ViewData.Model.HasNextPage)
                       { %>
                    <%=Html.ActionLink("下一页", "List", new { page = ViewData.Model.NextPage }, null)%>
                    <%=Html.ActionLink("最后页", "List", new { page = ViewData.Model.TotalPages }, null)%>
                    <% }
                       else
                       { %>
                    下一页 最后页
                    <% } %>
                </td>
            </tr>
        </table>
        <!--分页导航end-->
    </div>
    <p>
        <%
            if (Request.IsAuthenticated)
            {
        %>
        
        <%= Html.ActionLink("增加新商品", "Create") %>
        
        <%
            }    
        %>
    </p>
</asp:Content>
