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(); } }
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(); } } }