protected void UpdateBadges() { ApplicationDbContext context = new ApplicationDbContext(); var UserManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(context)); string user = User.Identity.GetUserId(); int value = Badges.CountActiveComissions(user); if (value == -1) { Response.Redirect("~/Error.aspx"); } BadgeCountActiveComissions.Text = value.ToString(); int value2 = Badges.CountPendingComissions(user); if (value == -1) { Response.Redirect("~/Error.aspx"); } BadgeCountPendingComissions.Text = value2.ToString(); BadgeComissions.Text = (value2 + value).ToString(); }