I have a requirement to switch on/off some of the features for my application. I am using WebApi and for each feature we have separate controller/class created which contains the WebApi calls for that particular feature.
When any WebApi call comes to controller I want to check the flag in the DB and base on that flag I want to allow/deny the WebApi call. Any suggestions?
Admin can on/off feature anytime (after the deployment also). Below is my sample code.
[RoutePrefix("api/Customer")]
[Authorize(Roles = "ABC")]
public class MyController : ApiController
{
[HttpPut]
[Route("{xyz}/abcd")]
[Authorize(Roles = "ABC")]
public async Task<IModel> CreateCust(string username)
{
}
[HttpPut]
[Route("{test}/test")]
[Authorize(Roles = "ABC")]
public async Task<IModel> UpdateCust(string username)
{
}
}
Thanks,
Pratik