llhd/Controllers/WebNew/GaleriController.cs

25 lines
688 B
C#

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