コード例 #1
0
        protected void StartUp()
        {
            if (this.signInManager.IsSignedIn(this.User))
            {
                this.userId = this.userManager.GetUserId(this.User);

                var messages = this.notificationService.GetNotificationsNavBar(this.userId);
                this.ViewData["MessageNavBar"] = messages;
            }
            else
            {
                NotificationsNavBarViewModel messages = new NotificationsNavBarViewModel();
                this.ViewData["MessageNavBar"] = messages;
            }
        }
コード例 #2
0
        public NotificationsNavBarViewModel GetNotificationsNavBar(string userId)
        {
            var notifications = this.context.Notifications
                                .Where(m =>
                                       m.DeletedOn == null &&
                                       m.UserId == userId &&
                                       m.SeenOn == null)
                                .Select(m => new NotificationNavBarViewModel()
            {
                CreatedOn          = m.CreatedOn,
                Id                 = m.Id,
                TextOfNotification = m.TextOfNotification,
                SeenOn             = m.SeenOn,
            })
                                .ToList();

            var result = new NotificationsNavBarViewModel(notifications);

            return(result);
        }