Im writing a basic CRM to capture leads.
You are able to add notes to leads.
I want to return a list of leads that have no notes within the last two days.
I cant work out the linq query to enable this.
So far i have the following which will return all the leads without a note.
vm.LeadsNoNotes = _context.Lead.Include(x => x.Notes).Where(x => x.Notes.Count == 0).Take(10).ToList();
below is my model structure
public class Lead
{
public int LeadId { get; set; }
public DateTime? DateCreated { get; set; }
public DateTime? DateModified { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string Telephone { get; set; }
public string Comment { get; set; }
public string Status { get; set; }
public string Source { get; set; }
public string PreferedContactMethod { get; set; }
public string Vehicle { get; set; }
public List<Note> Notes { get; set; }
}
public class Note
{
public int NoteId { get; set; }
public int? LeadId { get; set; }
public int? CreditApplicationId { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateModified { get; set; }
public DateTime NoteDate { get; set; }
public string UserId { get; set; }
[Required]
public string Subject { get; set; }
[DataType(DataType.MultilineText)]
public string Description { get; set; }
}