I built a class:
public partial class SvcCodes
{
public List<SvcCodeReport> Report { get; set; }
public List<SvcCodesCheck> TestList { get; set; }
}
It uses this class:
public partial class SvcCodeReport
{
public List<Dictionary<string, object>> ProgResults { get; set; }
public IEnumerable<ExtraData> ExtraData { get; set; }
}
In the controller, data is pulled from two sources and assigned to the SvcCodeReport class:
var model = new SvcCodeReport()
{
ProgResults = tasks,
ExtraData = _context.ExtraData.Where(h => h.ServiceCode == Int32.Parse(id)
};
Then the model variable is added to the Report class:
check.Report.Add(model);
But when I run the program, I get a null object error and a line that says:
LRProgReport.Models.SvcCodes.Report.get returned null
Is this error saying that Report is null BEFORE the add or after?
If before, why is that an issue? If after, why is the model variable not being added to the list?