← Back to Files
Files.cshtml.cs
using KaiChat.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace KaiChat.Pages;
public class FilesModel : PageModel
{
private readonly IFileService _file;
public FilesModel(IFileService file)
{
_file = file;
}
public string CurrentPath { get; set; } = "";
public List<KaiChat.Models.FileItem> Contents { get; set; } = new();
public void OnGet(string? path)
{
CurrentPath = path?.TrimStart('/') ?? "";
Contents = _file.GetDirectoryContents(CurrentPath);
}
}