net i have this Controller that gets data from a table :
Entity/model :
using Microsoft.EntityFrameworkCore;
namespace ESM_DASHBOARD.Data.Entities
{
    [Keyless]
    public class wareh_KPI_IN
    {
        public int total_in { get; set; }
        public Decimal price { get; set; }
        public double total_value { get; set; }
        public int Week_nb { get; set; }    
        public int Month_nr { get; set; }
    }}
this is the code :
using ESM_DASHBOARD.Data;
using ESM_DASHBOARD.Data.Entities;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace ESM_DASHBOARD.Controllers
{
    [Route("[controller]")]
    [ApiController]
    public class wareh_KPI_INController : ControllerBase
    {
        private readonly EsmDashboardContext _esmDashboardContext;
        public wareh_KPI_INController(EsmDashboardContext esmDashboardContext)
        {
            _esmDashboardContext = esmDashboardContext;
        }
        [HttpGet]
        public async Task<IActionResult> Get()
        {
            var wareh_KPI_INs = await _esmDashboardContext.wareh_KPI_IN.ToArrayAsync();
            return Ok(wareh_KPI_INs);
        }
    }
}
i tried to add this but its not working it displays (Object reference not set to an instance of an object)
        [HttpGet("{Week_nb}")]
        public async Task<IActionResult> Get(int Week_nb)
        {
            var wareh_KPI_INs = await _esmDashboardContext.wareh_KPI_IN.FindAsync(Week_nb);
            return Ok(wareh_KPI_INs);
        }
    }
}
 
    