I have a model that looks like this
public class ReferralModel
{
public string? ClientName { get; set; }
public Guid? ClientId { get; set; }
public string? ClientNumber { get; set; }
public string? ClientDOB { get; set; }
public string? DateSubmitted { get; set; } = default;
public DateTime? ModifiedDateSubmitted { get; set; }
public string? ReportStatus { get; set; }
public string? ReferralNotes { get; set; }
public ReferralForm? referralForm { get; set; }
}
public class ReferralForm
{
public Guid FileId { get; set; }
public Guid ClientId { get; set; }
public string? Name { get; set; }
public string? FileName { get; set; }
public string? ContentType { get; set; }
public string? FileExtension { get; set; }
public byte[]? FileContent { get; set; }
public DateTime CreatedDate { get; set; }
}
I have two separate lists that both have the same ClientId.
var referrals = new List<ReferralModel>();
var referralForms = new List<ReferralForm>();
I want to add the referral forms list to its corresponding ReferralList so that each referral list will have the correct Referral form (ReferralForm? referralForms).
referrals.referralForm = referralForms.Where(x => x.ClientId == referrals.ClientId);
I thought about looping through each of the list of referrals, but the list could be in the thousands and that seems like it would take too much time. This has to be almost instant mapping