using Application.Abstractions.Messaging; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; namespace Admin.Pages.Payments.Toss.Cancel; public class ViewModel(IMediator mediator) : PageModel { [BindProperty(SupportsGet = true)] public int ID { get; set; } public GetTossCancel.Response? Data { get; set; } public async Task OnGetAsync(CancellationToken ct) { try { Data = await mediator.Send(new GetTossCancel.Query(ID), ct); return Page(); } catch (Exception e) { TempData["ErrorMessages"] = e.Message; return RedirectToPage("/Payments/Toss/Cancel/Index"); } } }