I have the following schema :
public class Provider
{
[Key]
public int ProviderId { get; set; }
[ForeignKey("ProviderId")]
public ApplicationUser User;
public ICollection<ServiceProvider> Services { get; set; }
}
public class ApplicationUser : IdentityUser
{
public ApplicationUser() : base() { }
public string Name { get; set; }
public string Address { get; set; }
public string Photo { get; set; }
public string BusinessName { get; set; }
}
In my backend, I have an email as input and I'm trying to check if there is any provider with that email. I tried to use the following code :
if (context.Provider.Any(o => o.User.Email == input_mail) == false)
but I got a null pointer exception..
I know that I can use linku syntax :
var q = from au in _context.ApplicationUser
join p in _context.Provider on au.Id equals p.ProviderId
where au.Email=input_mail;
Any way to do it using the models context ? instead of linku