28 lines
752 B
C#
28 lines
752 B
C#
using System.Linq;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace BankSampahApp.Controllers.ReduksiSampah
|
|
{
|
|
[Route("ReduksiSampah/[controller]/[action]")]
|
|
public class MaggotController : Controller
|
|
{
|
|
private const string Jenis = "Maggot";
|
|
|
|
public IActionResult Index()
|
|
{
|
|
return View("~/Views/ReduksiSampah/Maggot/Index.cshtml");
|
|
}
|
|
|
|
[HttpGet]
|
|
public IActionResult Table([FromQuery] string? bulan)
|
|
{
|
|
var data = ReduksiSampahDataStore
|
|
.GetItems(Jenis)
|
|
.Where(item => ReduksiSampahDataStore.MatchesBulan(item, bulan))
|
|
.Select(ReduksiSampahDataStore.ToResponse);
|
|
|
|
return Json(new { data });
|
|
}
|
|
}
|
|
}
|