llhd/Controllers/WebNew/LayananController.cs

28 lines
620 B
C#

using Microsoft.AspNetCore.Mvc;
namespace WebApplication2.Controllers.WebNew
{
public class LayananController : Controller
{
[HttpGet("/WebNew/Layanan")]
public IActionResult Index(string jenis)
{
ViewBag.Jenis = jenis;
return View();
}
[HttpGet("/WebNew/Layanan/GetData")]
public IActionResult GetData(string jenis)
{
var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/webnew/json/Layanan", $"{jenis}.json");
if (!System.IO.File.Exists(path))
return NotFound();
var json = System.IO.File.ReadAllText(path);
return Content(json, "application/json");
}
}
}