I’m in the process of recreating our website using MVC3. I can not wrap my head around a solution to reproduce some old site functionality.
Our current site displays a parcel and displays two buttons, nextID, previousID each of those buttons returns a url string from a call to a function (ASP Classic) that looks like this.
Function GetNextID()
Dim Temp
SQLStmt.CommandText = "SELECT AccountNumber FROM " & DBOwner & "DataProperty Where cardnumber=1 and NBC <> 'TPMH' and LUC <> '6832' and closed = 0 and ParcelID > '" & PropertyID & "' order by ParcelID asc"
RSProp.Open SQLStmt
If Not RSProp.EOF Then
Temp = RSProp("AccountNumber")
Else
Temp = ""
End If
RSProp.Close
GetNextID = Temp
End Function 'GetNextID
Is there a better way to do this? Is there a way to page data at the detail level inherently designed in MVC3?
What I don’t want to do is this…
ViewResult Show(string parcelId)
{
if(Request["next"] == "next")
return _service.GetNextId(parcelId);
if(Request["prev"] == "prev")
return _service.GetPrevId(parcelId);
//Or return this parcel
return _service.getProperty(parcelId);
}
I’m going to do this in the viewModel I’ve decided.
I’ll just have a property on the ViewModel, .PriorId and .NextId