WIP setting up new data project structure and event handlers

This commit is contained in:
Giovani
2019-04-23 17:42:16 +00:00
parent 4074d101b2
commit 3dd68121ee
18 changed files with 196 additions and 85 deletions

View File

@@ -0,0 +1,29 @@
using BrightGlimmer.Data.Interfaces;
using BrightGlimmer.Domain;
using BrightGlimmer.Services.Queries;
using MediatR;
using Microsoft.EntityFrameworkCore; /* TODO */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace BrightGlimmer.Services.Handlers.QueryHandlers
{
public class GetAllStudentsQueryHandler : IRequestHandler<GetAllStudentsQuery, IEnumerable<Student>>
{
private readonly IRepository<Student> repository;
public GetAllStudentsQueryHandler(IRepository<Student> repository)
{
this.repository = repository;
}
public async Task<IEnumerable<Student>> Handle(GetAllStudentsQuery request, CancellationToken cancellationToken)
{
return await repository.Get().ToListAsync();
}
}
}

View File

@@ -0,0 +1,12 @@
using BrightGlimmer.Domain;
using MediatR;
using System;
using System.Collections.Generic;
using System.Text;
namespace BrightGlimmer.Services.Queries
{
public class GetAllStudentsQuery : IRequest<IEnumerable<Student>>
{
}
}