asp.net mvc - Mapping fields to certain users in mvc -


i creating mvc application in vb.net in trying map fields users specific individual users. have 4 sql tables connected involved in mapping. usertable, clienttable, projecttypetable , issuetable.

what trying this: user id of 1 log on, id , match userid in clienttable correct user client. once get clientid , match projecttypetable multiple correct projecttypes, eg client can have 1-8 projects available them. issuetable have selected projecttype.

i have created viewmodel looks this:

public class clientviewmodel     public protable list(of projecttype)     public ctable clienttable     public utable usertable     public itable issuetable end class 

what planned retrieve userid when user logs on , pass other views in session state correct userid kept through out project until log out. here have tried:

dim utable sqldatabase = new sqldatabase() dim getuserid = (from data in utable.usertables data.username = user.username andalso data.userpassword = user.userpassword select data.userid)  if (getuserid .count() > 0) session("useriddata") = getuserid.tostring() 

then in submit controller have this:

dim getuserid = session("useriddata") dim usermodel = new issuetracker.clientviewmodel() usermodel.ctable = dbserver.clienttables.where(function(x) x.userid = "") 'the speech marks userid retrieved session state usermodel.protable = dbserver.projecttypes.where(function(x) x.client = "").tolist() 'the speech marks clientid retrieved session state 

the problem having not getting id, way map users specific fields? id's not have sent across via session state last thing tried. how can correctly?


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -