bps-rw/Controllers/LaporanRwController.cs

48 lines
1.6 KiB
C#

using Microsoft.AspNetCore.Mvc;
namespace BpsRwApp.Controllers
{
[Route("[controller]/[action]")]
public class LaporanRwController : 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];
var bulan = ControllerSampleData.BulanNames[index % ControllerSampleData.BulanNames.Length];
var status = index % 4 == 0
? "<div class=\"badge badge-error badge-soft rounded-full\">Belum Verifikasi</div>"
: "<div class=\"badge badge-success badge-soft rounded-full\">Verifikasi</div>";
return new
{
kelurahan = wilayah.Kelurahan,
rw = (index % 20) + 1,
bulan,
rumah_aktif_memilah = 450 + (index * 11 % 600),
status,
aksi = "<div class=\"flex gap-2\">" +
"<a href=\"#\" class=\"btn bg-white rounded-full btn-sm\">Detail</a>" +
"</div>",
};
})
.ToArray();
var response = new
{
data = data
};
return Json(response);
}
}
}