In an action method of mvc project i get error of null reference
public async Task<IActionResult> List()
{
var solvency = await _solvencyRepository.GetClientiAsync();
var orders = await _ordersRepository.GetOrders();
var userOrders = (from o in orders
join s in solvency on o.Code equals s.Code into os
from x in os.DefaultIfEmpty()
orderby o.Date descending
let block = ...
select new
{
Codcli = o.Codcli,
CustomerName = o.Customer.Name,
...
}).ToList();
return Ok(userOrders);
}
The error refers to CustomerName
how can solve?