Major update

This commit is contained in:
2023-06-01 08:52:05 -05:00
parent d7c0f373f4
commit df84287eb2
264 changed files with 8614 additions and 964 deletions

View File

@@ -0,0 +1,27 @@
using System;
using Leagues.DbContexts;
using Leagues.Entities;
using Leagues.Helpers;
using Leagues.Queries;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Leagues.Handlers
{
public class GetLeaguesQueryHandler : IRequestHandler<GetLeaguesQuery, PagedList<League>>
{
private readonly LeaguesContext _dbContext;
public GetLeaguesQueryHandler(LeaguesContext dbContext)
{
_dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
}
public async Task<PagedList<League>> Handle(GetLeaguesQuery request, CancellationToken cancellationToken)
{
var leagues = await _dbContext.Leagues.ToListAsync();
return PagedList<League>.ToPagedList(await _dbContext.Leagues.ToListAsync(), request.PageNumber, request.PageSize);
}
}
}