llhd/Controllers/VideoController.cs

23 lines
591 B
C#

using Microsoft.AspNetCore.Mvc;
namespace WebApplication2.Controllers
{
public class VideoController : Controller
{
public IActionResult Index()
{
return View("~/Views/Video.cshtml");
}
public IActionResult GetAll()
{
var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/json", "video.json");
if (!System.IO.File.Exists(path))
return NotFound();
var json = System.IO.File.ReadAllText(path);
return Content(json, "application/json");
}
}
}