예제 #1
0
 public VMNotification(VMAnnouncementNotification f)
 {
     UserId           = f.UserId;
     TimeStamp        = f.TimeStamp;
     IsSeen           = f.IsSeen;
     Title            = f.Title;
     Description      = f.Description;
     URL              = f.URL;
     Sender           = f.Sender;
     NotificationType = NotificationType.LeaveCard;
     SenderId         = f.SenderId;
 }
 public VMNotification(VMAnnouncementNotification f)
 {
     UserId = f.UserId;
     TimeStamp = f.TimeStamp;
     IsSeen = f.IsSeen;
     Title = f.Title;
     Description = f.Description;
     URL = f.URL;
     Sender = f.Sender;
     NotificationType = NotificationType.LeaveCard;
     SenderId = f.SenderId;
 }
        public ActionResult AnnouncementNotification(VMAnnouncementNotification a)
        {
            if (ModelState.IsValid)
            {
                List<int> allUserIds = data.retrieveAllUserIds();
                foreach (int id in allUserIds)
                {
                    Notification announcement = new Notification
                    {
                        Description = a.Description,
                        isSeen = false,
                        NotificationType = (int)NotificationType.GlobalAnnouncement,
                        Sender = a.Sender,
                        SenderId = WebSecurity.CurrentUserId,
                        TimeStamp = DateTime.UtcNow,
                        Title = a.Title,
                        URL = null,
                        UserId = id
                    };
                    data.addNotification(announcement, id);
                }

                return View(viewName: "index");
            }

            return View();
        }