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("~/Views/WebNew/Layanan/Index.cshtml");
		}

		[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");
		}
	}

}