I have a controller that I want to set custom settings for people to be able to see it.
Controller
[Authorize(UserRoles.Admin)]
public ActionResult Index()
{
return View();
//SqlConnect(url);
}
Model
public enum UserRoles
{
Admin,
Employee,
Guest
}
public class RegisterViewModel
{
[Required]
[Display(Name = "User Role")]
public UserRoles UserRoles { get; set; }
}
I keep seeing syntax that say that this is the correct way to do it, but I can't get it to work. Help please and thank you.