| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using SharedKernel.Helpers;
- using Domain.Entities.Developers.ValueObject;
- using Application.Abstractions.Messaging;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.RazorPages;
- using System.ComponentModel;
- using System.ComponentModel.DataAnnotations;
- namespace Admin.Pages.Developers.Purchases;
- public class IndexModel(IMediator mediator) : PageModel
- {
- [BindProperty(SupportsGet = true)]
- public QueryParams Query { get; set; } = new();
- public sealed class QueryParams
- {
- public ApiPurchaseStatus? Status { get; set; }
- public string? Keyword { get; set; }
- [DataType(DataType.Date)]
- public DateTime? From { get; set; }
- [DataType(DataType.Date)]
- public DateTime? To { get; set; }
- [DisplayName("금액 불일치만")]
- public bool OnlyMismatch { get; set; }
- [Range(1, int.MaxValue)]
- [DisplayName("페이지 번호")]
- public int PageNum { get; set; } = 1;
- [Range(1, 100)]
- [DisplayName("페이지 목록 수")]
- public ushort PerPage { get; set; } = 20;
- }
- public int Total { get; set; }
- public Application.Features.Admin.Developers.Purchases.Search.Response.SummaryData? Summary { get; set; }
- public List<Application.Features.Admin.Developers.Purchases.Search.Response.Row> List { get; set; } = [];
- public Pagination? Pagination { get; set; }
- public async Task OnGetAsync(CancellationToken ct)
- {
- if (!ModelState.IsValid)
- {
- return;
- }
- var result = await mediator.Send(new Application.Features.Admin.Developers.Purchases.Search.Query(
- Query.Status, Query.Keyword, Query.From, Query.To, Query.OnlyMismatch, Query.PageNum, Query.PerPage
- ), ct);
- Total = result.Total;
- Summary = result.Summary;
- List = [..result.List];
- Pagination = new Pagination(result.Total, Query.PageNum, Query.PerPage);
- }
- }
|