Create readme.txt (#33265)

* Create readme.txt

* Delete aspnetcore/data/ef-rp/intro/samples/cu80 directory
pull/33255/head
Rick Anderson 2024-08-05 16:23:34 -10:00 committed by GitHub
parent f14939ae22
commit 36b11ec0a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 1 additions and 49 deletions

View File

@ -1,36 +0,0 @@
// See https://github.com/dotnet/AspNetCore.Docs/pull/28082
// This code has been proposed but has not be tested.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace ContosoUniversity
{
public class PaginatedList<T> : List<T>
{
public PaginatedList(IEnumerable<T> items, int count, int pageIndex, int pageSize = 20)
{
PageIndex = pageIndex;
TotalPages = (int)Math.Ceiling(count / (double)pageSize);
this.AddRange(items);
}
public bool HasPreviousPage => PageIndex > 1;
public bool HasNextPage => PageIndex < TotalPages;
public int PageIndex { get; private set; }
public int TotalPages { get; private set; }
public static async Task<PaginatedList<T>> CreateAsync(
IQueryable<T> source, int pageIndex, int pageSize = 20)
{
var count = await source.CountAsync();
var items = await source.Skip(
(pageIndex - 1) * pageSize)
.Take(pageSize).ToListAsync();
return new PaginatedList<T>(items, count, pageIndex, pageSize);
}
}
}

View File

@ -1,13 +0,0 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"SchoolContextSQLite": "Data Source=CU.db"
},
"MyMaxModelBindingCollectionSize": "3"
}

View File

@ -0,0 +1 @@
Delete this readme file when the code has been updated to .NET 9