asp.net mvc - Unable to create a constant value of type 'System.Object'. Only primitive types or enumeration types are supported in this context -


i have nurse , patient tables having many many relationship; thus, third relationship table nurse_patient consisting of n_id , p_id.

once nurse logins session created. want select patients of logged in nurse only. tried code below it's giving error shown in title.

if (session["logeduserid"] != null) {    int p = convert.toint32(session["logeduserid"]);    var patients = db.patients.where(a => a.nurse_patient.select(x => x.n_id).equals(p)).tolist();    return view(patients); } 

var patients = db.nurse_patient.where(e => e.nurse.id == nid).select(e => e.patient).tolist(); 

this solved it. thanks


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -