initial commit

This commit is contained in:
2026-07-21 14:22:06 +07:00
commit 2d7959f202
572 changed files with 45295 additions and 0 deletions
@@ -0,0 +1,41 @@
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Multitenant.Tenant.Cqrs;
public class GetTenantListResponse
{
public string? Id { get; set; }
public string? Name { get; set; }
public string? PhoneNumber { get; set; }
public string? EmailAddress { get; set; }
public string? City { get; set; }
public bool IsActive { get; set; }
}
public record GetTenantListQuery() : IRequest<List<GetTenantListResponse>>;
public class GetTenantListHandler : IRequestHandler<GetTenantListQuery, List<GetTenantListResponse>>
{
private readonly AppDbContext _context;
public GetTenantListHandler(AppDbContext context) => _context = context;
public async Task<List<GetTenantListResponse>> Handle(GetTenantListQuery request, CancellationToken cancellationToken)
{
return await _context.Tenant
.AsNoTracking()
.OrderBy(x => x.Name)
.Select(x => new GetTenantListResponse
{
Id = x.Id,
Name = x.Name,
PhoneNumber = x.PhoneNumber,
EmailAddress = x.EmailAddress,
City = x.City,
IsActive = x.IsActive
})
.ToListAsync(cancellationToken);
}
}