Im trying to acess my database via the application db context class that has dbsets of each table, my objetive is to retrieve a field from the database from a specific user that is inserted on a input on login, however im unsure as to how i can query the database via LINQ to get the specific field from the user
//Search if username exists on database(working)
var user = _context.User.Where(a => a.Username == Credential.Username).FirstOrDefault();
//Get the salt from that user(not working)
var salt = _context.User.Where(a => a.Username == Credential.Username).Select(a => a.Salt);
//Get the hash from that user(also not working)
var hash = _context.User.Where(a => a.Username == Credential.Username).FirstOrDefault();
if (user!= null && Credential.Username == user.Username && Credential.Password =="password")
{
My objective is to first check if the user exists via comparing the inputed username to the existing users on the database, then getting his salt, to salt his input and hash it to compare it to the existing hashes on my database, but im not sure how to query the DBset via LINQ is there any recommended way to do these queries?