I need a way to get matching records of the ProcessedBy
column and user.Id
(which in db share exact same string but in different tables).
Short: 'user' is an instance of the ApplicationUser Class and ProcessedBy is a property in LI class of type ApplicationUser. Problem: If I apply ProcessedBy.ToString() there will be a error "Cannot convert ApplicationUser to string". ProcessedBy is a property of class ApplicationUser which contains Id directly, user is an object of class ApplicationUser which contains Id as a string property, not my design I need to figure this out.
public static void UpdateFilesProcessedByUser(ApplicationUser user)
{
ApplicationDbContext db = new ApplicationDbContext();
//Cannot convert ApplicationUser ProcessedBy to string, user.Id is a string
IQueryableL<LI> DbQueryGet = db.LIs.Where(l =>
l.ProcessedBy.ToString() == user.Id);
var GetNumberOfFiles = DbQueryGet.ToList().Count();
IQueryable<ApplicationUser> DbQueryUpdate = db.Users.Where(u => u.Id == user.Id);
var GetUser = DbQueryUpdate.ToList();
GetUser[0].FilesProcessed = GetNumberOfFiles;
db.SaveChanges();
}
And LI class which contains ProcessedBy :
[Table("LIs")]
public class LI
{
.
.
.
public virtual ApplicationUser ProcessedBy {get; set;}
}