I have rows with different guids in my database table:
public class News
{
public int NewsId { get; set; }
public string title { get; set; }
public string description { get; set; }
public int guid { get; set; }
}
And I want to create groups of users, that will be able to view news with a certain guid. I am using ASP.NET MVC template with users authentication, but I can't understand how should I approach my goal? I can register users, I read about roles and filters, but it didn't help.
[Authorize]
public ActionResult GetNews()
{
// GET USER GUID AND RETRIEVE NEWS WITH THIS GUID??
}
Should I somehow search how to retrieve user's id in controller method, than make query to database and get users group to filter news list or there is solution more easy?
Also, in Django I was able to control users from prebuild admin panel, has ASP.NET MVC similar thing, or I should make my own controller for this? I need somehow add users to groups/(give them roles) if I want to filtering content for different users.