private bool HasAccessTo(UserRoleMethod method) { var returnBool = false; switch (method) { case UserRoleMethod.CanCreateBooking: returnBool = CanCreateBooking; break; case UserRoleMethod.CanViewDashboard: returnBool = CanViewDashboard; break; } return(returnBool); }
public static bool Can(User u, UserRoleMethod method) { return(u != null && u.UserRole.HasAccessTo(method)); }
public static bool Can(this ViewContext view, UserRoleMethod method) { var user = CurrentUser(view); return(UserRole.Can(user, method)); }