Convert two strings and compare them with each other

I used two strings, one for today's date and one for the database, which is the date that users register. I want to convert these two strings to a solar date and compare them.

This code works well and I converted the first variable correctly and I can compare it

 PersianDateTime now = PersianDateTime.Now;
 string s = now.ToString("yyyy/MM/dd");
PersianDateTime persianDate = PersianDateTime.Parse(s);

But this code gives an error because it becomes a condition

 var ActivitysNotToDo = _context.Activitys.Where(a => a.MasoolAghdamUserID == user.Id && PersianDateTime.Parse(a.ActvityAghdamDate) < persianDate).ToList();

An error occurred in this code. Please also see the photo

PersianDateTime.Parse(a.ActvityAghdamDate)

enter image description here


If the first code works for you, then:

Maybe you can modify this line:

var ActivitysNotToDo = _context.Activitys.Where(a => a.MasoolAghdamUserID == user.Id && PersianDateTime.Parse(a.ActvityAghdamDate) < persianDate).ToList();

For this:

var ActivitysNotToDo = _context.Activitys.Where(a => a.MasoolAghdamUserID == user.Id && PersianDateTime.Parse(Convert.ToDateTime(a.ActvityAghdamDate).ToString("yyyy/MM/dd")) < persianDate).ToList();

DateTime.Parse(); function need string parameter so you have to pass string parameter in your expression.

DateTime now = DateTime.Now;
 string s = now.ToString("yyyy/MM/dd");
 DateTime.Parse(s);

 DateTime.Parse(now.ToString()); // Conversion required

Try following code.

PersianDateTime.Parse(a.ActvityAghdamDate.Value.ToString("yyyy/MM/dd"))
or 
PersianDateTime.Parse(Covert.ToDateTime(a.ActvityAghdamDate).ToString("yyyy/MM/dd"))