/// <summary> /// Отправить всплывающие уведомления и письма о начале торгов /// </summary> /// <returns></returns> public async Task SendNotificationsAboutNewTrade() { foreach (var trade in GetCreatedTrades()) { // trade.SendPopups(trade.Buyers.SelectMany(c => c.ContragentUsers).Distinct().ToList(), _notificationHub, NotifyType.ToAllBuyersAboutStartTrade); foreach (var buyer in trade.Buyers.SelectMany(c => c.ContragentUsers).Distinct().ToList()) { //EmailFactory.SendEmailAsync(new NewTrade(buyer, trade.Id)); _notificationHub.GoToTrade(buyer.UserName, trade.Id); } foreach (var seller in trade.Seller.ContragentUsers.Distinct().ToList()) { // EmailFactory.SendEmailAsync(new NewTrade(seller, trade.Id)); _notificationHub.GoToTrade(seller.UserName, trade.Id); } trade.IsProcessed = true; await _context.UpdateEntityAsync(trade); } }