コード例 #1
0
        public void Notify(ViewModels.InputNotificationModel notification)
        {
            var notify = new Notification()
            {
                CreationDate = BusinessSettings.ServerNow,
                IsGeneral    = true,
                Message      = notification.Message,
                Seen         = false,
                Type         = notification.Type
            };

            using (var scope = new TransactionScope())
            {
                _unitOfWork.NotificationRepository.Add(notify);
                _unitOfWork.Save();
                scope.Complete();
            }
        }
コード例 #2
0
 public void Notify(ViewModels.InputNotificationModel notification, List <int> usersIds)
 {
     foreach (int userId in usersIds)
     {
         var notify = new Notification()
         {
             CreationDate = BusinessSettings.ServerNow,
             IsGeneral    = false,
             Message      = notification.Message,
             Seen         = false,
             Type         = notification.Type,
             UserId       = userId
         };
         using (var scope = new TransactionScope())
         {
             _unitOfWork.NotificationRepository.Add(notify);
             _unitOfWork.Save();
             scope.Complete();
         }
     }
 }