public void DeclineLead(UberLead lead, int id) { User user = GetUser(id); user.sendLead = null; user.requestedLead = false; _tasks.Add(receiveDecline = Task.FromResult(lead)); }
public async Task <bool> AcceptLead(UberLead lead, int id) { User user = GetUser(id); user.sendLead = null; user.requestedLead = false; _tasks.Add(receiveAcception = Task.FromResult(lead)); return(true); }
public void AddToQueue(UberLead lead) { if (_leads.Count > 12) { return; //Для тестирования, на бою убрать } lock (_locker) { if (!_leads.Any(x => x.leadId == lead.leadId)) { _leads.Enqueue(lead); } } if (!distributing) { distributing = true; Task.Run(() => Distribute()); } }
public void SendLead(UberLead lead) { sendLead?.Invoke(lead); }