diff --git a/Bootstrap.Admin/Models/HeaderBarModel.cs b/Bootstrap.Admin/Models/HeaderBarModel.cs index 18841d5d..065e6c8c 100644 --- a/Bootstrap.Admin/Models/HeaderBarModel.cs +++ b/Bootstrap.Admin/Models/HeaderBarModel.cs @@ -21,7 +21,9 @@ namespace Bootstrap.Admin.Models var notis = NotificationHelper.RetrieveNotifications(); NotifiCount = notis.Count(); Notifications = notis.Take(6); - Messages = MessageHelper.RetrieveMessagesHeader(HttpContext.Current.User.Identity.Name); + var msgs = MessageHelper.RetrieveMessagesHeader(UserName); + MessageCount = msgs.Count(); + Messages = msgs.Take(6); } public string UserName { get; protected set; } /// @@ -53,9 +55,12 @@ namespace Bootstrap.Admin.Models /// public int NotifiCount { get; set; } /// - /// 或者/设置消息列表 + /// 获得/设置 消息列表 /// public IEnumerable Messages { get; set; } - + /// + /// 获得/设置 消息数量 + /// + public int MessageCount { get; set; } } } \ No newline at end of file diff --git a/Bootstrap.Admin/Views/Shared/Header.cshtml b/Bootstrap.Admin/Views/Shared/Header.cshtml index e22343df..bc62bc1a 100644 --- a/Bootstrap.Admin/Views/Shared/Header.cshtml +++ b/Bootstrap.Admin/Views/Shared/Header.cshtml @@ -108,42 +108,42 @@ - @if (Model.Messages.Count() > 0) - { - - } + @if (Model.MessageCount > 0) + { + + } @if (Model.NotifiCount > 0) { -