public async Task SendOutCustomNotification(NewNotificationDTO dto) { foreach (var user in dto.Players) { var notification = new DAL.App.DTO.Notification { Title = dto.Title, Content = dto.Content, AppUserId = user.Id, NotificationType = "View", TrainingId = null }; notification = ServiceRepository.AddNewNotification(notification); sendOutNotification(notification, user); } await ServiceUnitOfWork.SaveChangesAsync(); }
public async Task SendOutNewTrainingNotifications(ICollection <UserDTO> users, string content, Training training) { foreach (var user in users) { var notification = new Notification { Title = "New training invitation", Content = "You have been invited to training", AppUserId = user.Id, Recived = false, NotificationType = "Training Invitation", TrainingId = training.Id }; sendOutNotification(notification, user); ServiceRepository.AddNewNotification(notification); } await ServiceUnitOfWork.SaveChangesAsync(); }