I have created a database system for a library, and when a user registers the program checks if they already have an account, but this is always returning false even when I can see in my DBMS that the record exists.
public static bool UserExists(string email)
{
using (var context = new LibraryDbContext())
{
if (context.Users.Any(d => d.Email == email))
{
return true;
}
else
{
return false;
}
}
}
Also, this is my Dbcontext class
public class LibraryDbContext : DbContext
{
public LibraryDbContext()
: base()
{
}
public DbSet<Book> Books { get; set; }
public DbSet<User> Users { get; set; }
public DbSet<ReturnsLog> Returns { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseInMemoryDatabase("LibraryProjectDbo");
}
}