using Microsoft.AspNetCore.Mvc;

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

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

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

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