'How to fill attribute value from database on Razor Pages .netCore

I have an attribute above the action Method, the value of which must be filled from the database But I do not know how to do this I want to use this attribute in filters, In general, I do not want to show some menus (those whose value in the database is false) to users. What do you suggest?

 public class MessagesModel : PageModel
{
    public List<TableEmailSendHistory> Emails;
    private readonly IMessageServices _message;
    private readonly IAuthHelper _authHelper;

    public MessagesModel(IMessageServices message, IAuthHelper authHelper)
    {
        _message = message;
        _authHelper = authHelper;
    }

    
    [SetPermission(true)]
    public void OnGet()
    {
        var userId = _authHelper.CurrentAccountInfo().Id;
        Emails = _message.GetAllEmails(userId);
    }

}

I want to call the value (true) from the database, Now how do I get this value from the Method body or from the action input parameters or from the dependency injection?

Thanks for your reply



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source