Polianin Nikita
bc99007d94
All checks were successful
.NET Test Pipeline / build-and-test (pull_request) Successful in 1m36s
26 lines
880 B
C#
26 lines
880 B
C#
using MediatR;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Mirea.Api.DataAccess.Application.Interfaces.DbContexts.Schedule;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Mirea.Api.DataAccess.Application.Cqrs.Campus.Queries.GetCampusBasicInfoList;
|
|
|
|
public class GetCampusBasicInfoListQueryHandler(ICampusDbContext dbContext) : IRequestHandler<GetCampusBasicInfoListQuery, CampusBasicInfoVm>
|
|
{
|
|
public async Task<CampusBasicInfoVm> Handle(GetCampusBasicInfoListQuery request, CancellationToken cancellationToken)
|
|
{
|
|
var dtos = await dbContext.Campuses.Select(c => new CampusBasicInfoDto()
|
|
{
|
|
Id = c.Id,
|
|
CodeName = c.CodeName,
|
|
FullName = c.FullName
|
|
}).ToListAsync(cancellationToken);
|
|
|
|
return new CampusBasicInfoVm
|
|
{
|
|
Campuses = dtos
|
|
};
|
|
}
|
|
} |