@ModelType PagedList.IPagedList(Of VBLinqTest. QueryResult )
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
@Html.PagedListPager(Model, Function(page) Url.Action("Index", New With {page}), PagedListRenderOptions.ClassicPlusFirstAndLast)
<Table Class="table">
<tr>
<th>
OrderID
</th>
<th>
CustomerID
</th>
<th>
ProductID
</th>
<th>
ProductName
</th>
@*<th>
UnitPrice
</th>*@
<th></th>
</tr>
@For Each item In Model
@<tr>
<td>
@Html.DisplayFor(Function(modelItem) item.OrderID)
</td>
<td>
@Html.DisplayFor(Function(modelItem) item.CustomerID)
</td>
<td>
@Html.DisplayFor(Function(modelItem) item.CompanyName)
</td>
<td>
@Html.DisplayFor(Function(modelItem) item.ProductID)
</td>
@*<td>
@Html.DisplayFor(Function(modelItem) item.)
</td>*@
<td>
@Html.ActionLink("Edit", "Edit", New With {.id = item.OrderID}) |
@Html.ActionLink("Details", "Details", New With {.id = item.OrderID}) |
@Html.ActionLink("Delete", "Delete", New With {.id = item.OrderID})
</td>
</tr>
Next
</Table>
------------------------- control
Function Index(Optional ByVal page As Integer = 1) As ActionResult
Dim aa As String = "A,O"
Dim whereCondition As String() = aa.Split(","c)
Dim query222 = (From order In db.Orders
From vendor In db.Order_Details.Where(Function(v) v.OrderID = order.OrderID).DefaultIfEmpty()
From status In db.Customers.Where(Function(s) s.CustomerID = order.CustomerID).DefaultIfEmpty()
Select New QueryResult With {.OrderID = order.OrderID, .CustomerID = order.CustomerID,
.ProductID = vendor.ProductID, .CompanyName = status.CompanyName,
.alldata = order.OrderID & order.CustomerID & vendor.ProductID & status.CompanyName}
).Where(Function(tt) tt.OrderID <= 10250).OrderBy(Function(v) v.OrderID)
Dim result = From p In query222
Where whereCondition.Any(Function(s) p.alldata.Contains(s))
Select p
Dim all = result.ToPagedList(page, 6)
Return View(all)
End Function
------------------------- model
Public Class QueryResult
Property OrderID As String
Property CustomerID As String
Property CompanyName As String
Property ProductID As String
'Property ProductName As String
Property UnitPrice As String
Property alldata As String
End Class