Im using .Find()
which searched for the table with the database but I need to find the value not using the primary key but instead the UserId.
ElearnUser loggedInUser = await _userManager.FindByEmailAsync(model.Email.ToString());
var meta = _elearnContext.UserMetaData.Find(loggedInUser.Id);
if (meta != null)
{
_elearnContext.UserMetaData.Remove(meta);
}
*** this gets the value I need but is it also multiple rows***
I'm not sure if that will work when I pass it to the .Remove()
My problem is that I cant use the var progresses
because it is queryable so my question is there anything like the .Find()
that searches for any column variable. Also, will I need to run a loop to delete each row?
var progresses = _elearnContext.Progress.Where(p => p.UserId == loggedInUser.Id);
if (progresses != null)
{
_elearnContext.Progress.Remove((Progress)progresses);
}