I have a linq query that returns a list and the result looks like this:
protected void Page_Load(object sender, EventArgs e)
{
var MyList = GetPatientsFromDB(TheUserID);
}
This list is of type MyModel like this:
MyModel
{
public int PatientID {get;set;}
}
Now what I’m looking to do is pass this list to a function called GetPatientInfo and return another list of MyOtherModel
MyOtherModel{
public int PatientID {get;set;}
public string Name {get;set;}
public string Region {get;set;}
}
I’m have some problems writing the second function.
I started with
public static List<MyOtherModel> GetPatientInfo(List<MyModel>
{
using (..... MyDC = new... DataContext)
{
var OutputList = from f in MyDC.Table
where......?
}
I’m stuck on writing the where clause and the calling statement. Thank you for suggestions.
1 Answer