| 123456789101112131415161718192021222324252627282930 |
- using Application.Abstractions.Messaging;
- using Application.Abstractions.Data;
- using Microsoft.EntityFrameworkCore;
- namespace Application.Features.Admin.Popup.Get;
- public sealed class Handler(IAppDbContext db) : IQueryHandler<Query, Response?>
- {
- public async Task<Response?> Handle(Query request, CancellationToken ct)
- {
- return await db.Popup
- .AsNoTracking()
- .Where(x => x.ID == request.ID)
- .Select(x => new Response
- {
- ID = x.ID,
- PositionID = x.PositionID,
- Subject = x.Subject,
- Content = x.Content,
- Link = x.Link,
- StartAt = x.StartAt,
- EndAt = x.EndAt,
- Order = x.Order,
- IsActive = x.IsActive,
- UpdatedAt = x.UpdatedAt,
- CreatedAt = x.CreatedAt
- })
- .FirstOrDefaultAsync(ct);
- }
- }
|