Skip to content

Instantly share code, notes, and snippets.

@rexcfnghk
Created July 1, 2016 03:26
Show Gist options
  • Select an option

  • Save rexcfnghk/84dc6bddb02f42be67dfeabb3703fe08 to your computer and use it in GitHub Desktop.

Select an option

Save rexcfnghk/84dc6bddb02f42be67dfeabb3703fe08 to your computer and use it in GitHub Desktop.
public class UserProfileActionFilterAttribute : ActionFilterAttribute
{
private readonly UserProfile _userProfile;
public UserProfileActionFilterAttribute(UserProfile userProfile)
{
_userProfile = userProfile;
}
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
filterContext.Controller.ViewBag.User = _userProfile;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment