llhd/Controllers/GaleriController.cs

23 lines
594 B
C#

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