static IEnumerable <Stops> Cal(string r) { BotStopEntities1 db = new BotStopEntities1(); //бд // список остановок List <Stops> stops = new List <Stops>(); foreach (Stop s in db.Stop) { stops.Add(new Stops((int)s.Id, s.StopStart.Split(new char[] { ',' }), s.StopEnd, s.SideCount)); } var selectedSide = from stop in stops from name in stop.StopStart where name == r.ToLower() select stop; return(selectedSide); }
static async void Bot_OnMessage(object sender, MessageEventArgs e) { //бд BotStopEntities1 db = new BotStopEntities1(); //бд ParserWorker <string> parser; //парсинг parser = new ParserWorker <string>( new CdsParser() ); // список остановок List <Stops> stops = new List <Stops>(); foreach (Stop s in db.Stop) { stops.Add(new Stops((int)s.Id, s.StopStart.Split(new char[] { ',' }), s.StopEnd, s.SideCount)); } Message message = e.Message; int userId = message.From.Id; if (message.Type == MessageType.Text) { if (Answers.TryGetValue(userId, out string[] answers))