I am new to C# and ASP.Net core razor pages. I think this is a simple question but after many hours I still have not been able to resolve it.
I am (currently) putting my business logic (eg Maintenance logic) in root/BLL/MaintenanceBLL/Maintenance.cs
In trying to read records in the Maintenance table from Maintenance.cs. I get the error
CS0030 Cannot convert type 'Club.Models.Maintenance' to 'Club.BLL.MaintenanceBLL.Maintenance'
The term ForEach is redlined in the code by VS2019. I cannot resolve this error. Any assistance would be appreciated.
My code is:
Namespace Club.BLL.MaintenanceBLL
{
public class Maintenance
{
private readonly Club.Data.ApplicationDbContext _context;
public Maintenance(Club.Data.ApplicationDbContext context)
{
_context = context;
}
public Maintenance()
{
}
public void DoMaintenance()
{
//Parse Maintenance table and action those items
//where Active=True and ActionDate has passed
var maintenances = _context.Maintenance;
foreach (Maintenance m in maintenances)
{
//do something
}
}
}
}