Ich versuche, eine Seitenumbruch in einem Kundencontroller mit ASP 5.0 WebAPI zu machen. Wenn ich versuche, diesem Beispiel zu tun, die ich erhalten:Seitennummerierung in WebAPI One Asp.Net (ASP5/vNext)
nicht implizit Kann Typ Microsoft.AspNet.Mvc.HttpOkObjectResult konvertieren
API.Controllers.IHttpActionResult Ich muss nur eine Sammlung von Kunden zurück mit die Nummer der aktuellen Seite, die Gesamtzahl der Seiten und Ergebnisse.
public IHttpActionResult Get(int offset = 0, int limit = 50)
{
// Get total number of records
int total = _dbContext.Customers.Count();
// Select the customers based on paging parameters
var customers = _dbContext.Customers
.OrderBy(c => c.Id)
.Skip(offset)
.Take(limit)
.ToList();
// Return the list of customers
return Ok(new
{
Data = customers,
Paging = new
{
Total = total,
Limit = limit,
Offset = offset,
Returned = customers.Count
}
});
}
Ändern Sie "IHttpActionResult" in "IActionResult" – Nkosi