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,26 @@
using System;
using MediatR;
using Microsoft.EntityFrameworkCore;
using Teams.DbContexts;
using Teams.Entities;
using Teams.Helpers;
using Teams.Queries;
namespace Teams.Handlers
{
public class GetTeamsQueryHandler : IRequestHandler<GetTeamsQuery, PagedList<Team>>
{
private readonly TeamsContext _dbContext;
public GetTeamsQueryHandler(TeamsContext dbContext)
{
_dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
}
public async Task<PagedList<Team>> Handle(GetTeamsQuery request, CancellationToken cancellation)
{
return PagedList<Team>.ToPagedList(await _dbContext.Teams.ToListAsync(), request.PageNumber, request.PageSize);
}
}
}