I am creating a website using ASP.NET MVC 5 in Visual Studio 2015, and I am new at this. I am using the ADO.net Entity Data Model to create a model based off my database. And then using a controller with views and Entity Framework.
My question is, that given the user is logged in. He is allowed to see data in that list that belongs to his UserID
, not other people's. How can I limit the scope to only show data that is limited to only be related to his UserID
?
The controller's code is still mostly under the default auto generated template.
没有更多信息,这是我能为您做的最好的事情。
YourContext.SomeTable.Where(s => s.OwnerUserId == currentUser.UserId)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.