llhd/Controllers/WebNew/VideoController.cs

25 lines
682 B
C#

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