38 lines
1003 B
C#
38 lines
1003 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace BpsRwApp.Controllers
|
|
{
|
|
[Route("[controller]/[action]")]
|
|
public class DataRtController : AppControllerBase
|
|
{
|
|
public IActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
[HttpGet]
|
|
public IActionResult Table()
|
|
{
|
|
var data = Enumerable.Range(0, 100)
|
|
.Select(index =>
|
|
{
|
|
var wilayah = ControllerSampleData.WilayahSeeds[index % ControllerSampleData.WilayahSeeds.Length];
|
|
return new
|
|
{
|
|
rt = ((index % 16) + 1).ToString("D3"),
|
|
rw = ((index / 5) + 1).ToString("D3"),
|
|
kecamatan = $"{wilayah.Kecamatan}, {wilayah.Kota}",
|
|
};
|
|
})
|
|
.ToArray();
|
|
|
|
var response = new
|
|
{
|
|
data = data
|
|
};
|
|
|
|
return Json(response);
|
|
}
|
|
}
|
|
}
|