public bool HasSuchDriver(DriverWorkModel driver) { if (Queue.Exists(d => d.Driver.Id == driver.Driver.Id)) { return true; } return false; }
public string addToQueue(int driverId , int regionId) { //Clients.All.hello(data); DriverManager dm = new DriverManager(); CityManager cm = new CityManager(); Region region = cm.GetRegionsById(regionId); Driver driver = dm.GetById(driverId); DriverWorkModel driver_wm = new DriverWorkModel(driver, Status.Online, region); driver_wm.SignalR_id = Context.ConnectionId; QueueController queueController = new QueueController(); if (!queueController.HasSuchDriver(driver_wm)) { queueController.AddToQueue(driver_wm); Groups.Add(driver_wm.SignalR_id, "Drivers"); return "queue count:" + queueController.GetConunt(); } return "this driver is alredy added in queue"; }
public void DeleteFomQueue(DriverWorkModel dwm) { Queue.Remove(dwm); }
public void AddToQueue(DriverWorkModel dwm) { Queue.Add(dwm); }