using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; namespace PRSA.App.Pages { public class IndexModel : PageModel { private readonly ILogger _logger; [BindProperty] public IFormFile File { get; set; } public bool UploadSuccess { get; private set; } public bool UploadError { get; private set; } // List of sheet names from the uploaded Excel file public List SheetNames { get; private set; } public IndexModel(ILogger logger) { _logger = logger; } public void OnGet() { // Initialize the list of sheet names (replace with your logic) SheetNames = new List { "Tracker", "SalesForecast", "StockBalance", "QlikviewSales" }; // Set the page title ViewData["Title"] = "Reporting System"; } public async Task OnPostAsync() { if (File != null && File.Length > 0) { try { // Save the uploaded file and process it as needed // For demonstration purposes, we'll just indicate a successful upload. // You would implement the actual file processing logic here. UploadSuccess = true; } catch { UploadError = true; } } // Re-initialize the list of sheet names (replace with your logic) SheetNames = new List { "Tracker", "SalesForecast", "StockBalance", "QlikviewSales" }; return Page(); } } }