| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- using SharedKernel.Helpers;
- using MediatR;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.RazorPages;
- using System.ComponentModel;
- using System.ComponentModel.DataAnnotations;
- using SearchLoginLogs = Application.Features.Member.LoginLog.Search;
- namespace Admin.Pages.Member.Log;
- public class LoginModel(IMediator mediator) : PageModel
- {
- [BindProperty(SupportsGet = true)]
- public QueryParams Query { get; set; } = new();
- public sealed class QueryParams
- {
- [Range(1, int.MaxValue)]
- [DisplayName("페이지 번호")]
- public int PageNum { get; set; } = 1;
- [Range(1, 100)]
- [DisplayName("페이지 목록 수")]
- public ushort PerPage { get; set; } = 10;
- [DisplayName("계정")]
- public string? Account { get; set; }
- [DisplayName("결과")]
- public bool? Success { get; set; }
- }
- public int Total { get; set; } = 0;
- public List<(
- int Num,
- int ID,
- int? MemberID,
- string? MemberName,
- string Account,
- bool Success,
- string? Reason,
- string? IpAddress,
- string? UserAgent,
- string CreatedAt
- )> List { get; set; } = [];
- public Pagination? Pagination { get; set; }
- public async Task OnGetAsync(CancellationToken ct)
- {
- if (!ModelState.IsValid)
- {
- return;
- }
- var result = await mediator.Send(new SearchLoginLogs.Query(
- Query.PageNum,
- Query.PerPage,
- Account: Query.Account,
- Success: Query.Success
- ), ct);
- Total = result.Total;
- List = [.. result.List.Select(c => (
- c.Num,
- c.ID,
- c.MemberID,
- c.MemberName,
- c.Account,
- c.Success,
- c.Reason,
- c.IpAddress,
- c.UserAgent,
- c.CreatedAt
- ))];
- Pagination = new Pagination(result.Total, Query.PageNum, Query.PerPage);
- }
- }
|