using Microsoft.AspNetCore.Mvc;

namespace WebApplication2.Controllers
{
    public class DetailItemController : Controller
    {
        public IActionResult Index(string kode)
        {
            ViewBag.Kode = kode;
            return View("~/Views/Layanan/DetailItem.cshtml");
        }

        public IActionResult GetDetail(string kode)
        {
            var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/json", "DetailItem.json");

            if (!System.IO.File.Exists(path))
                return NotFound();

            var json = System.IO.File.ReadAllText(path);
            return Content(json, "application/json");
        }
    }
}