bank-sampah/Controllers/ReduksiSampah/KompostingController.cs

28 lines
764 B
C#

using System.Linq;
using Microsoft.AspNetCore.Mvc;
namespace BankSampahApp.Controllers.ReduksiSampah
{
[Route("ReduksiSampah/[controller]/[action]")]
public class KompostingController : Controller
{
private const string Jenis = "Komposting";
public IActionResult Index()
{
return View("~/Views/ReduksiSampah/Komposting/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 });
}
}
}