public static async void EditTimetable(int userId, string message) { if (message == "Добавить рейс") { DataBaseContextAdmin.AddTrip(); DataBaseContextAdmin.SetTripId(userId, DataBaseContextAdmin.GetLastTripId()); DataBaseContextAdmin.SetCommandId(userId, (int)AdminCommandStep.DeparturePlace); await BotController.Bot.SendTextMessageAsync(userId, "Откуда рейс?", replyMarkup : KeyboardContainer.CreateTwoKeyboardAdminButtons()); } if (message == "Редактировать рейс") { await BotController.Bot.SendTextMessageAsync(userId, "Введите ID рейса для редактирования.", replyMarkup : KeyboardContainer.CreateTwoKeyboardAdminButtons()); DataBaseContextAdmin.SetCommandId(userId, (int)AdminCommandStep.SetTripIdEdit); } if (message == "Удалить рейс") { await BotController.Bot.SendTextMessageAsync(userId, "Введите ID рейса для удаления.", replyMarkup : KeyboardContainer.CreateTwoKeyboardAdminButtons()); DataBaseContextAdmin.SetCommandId(userId, (int)AdminCommandStep.SetTripIdDel); } if (message == "Отмена") { Undo(userId); } }
public static async void ChooseTripColumn(int userId, string message) { try { var keyCommands = new Dictionary <string, string>(); keyCommands.Add("Место отправки", AdminCommandStep.DeparturePlace.ToString()); keyCommands.Add("Дата отправки", AdminCommandStep.DepartureDate.ToString()); keyCommands.Add("Время отправки", AdminCommandStep.DepartureTime.ToString()); keyCommands.Add("Место прибытия", AdminCommandStep.ArrivalPlace.ToString()); keyCommands.Add("Дата прибытия", AdminCommandStep.ArrivalDate.ToString()); keyCommands.Add("Время прибытия", AdminCommandStep.ArrivalTime.ToString()); if (keyCommands.ContainsKey(message)) { keyCommands.TryGetValue(message, out var resMessage); DataBaseContextAdmin.SetColumn(userId, resMessage); await BotController.Bot.SendTextMessageAsync(userId, "Введите новое значение.", replyMarkup : KeyboardContainer.CreateTwoKeyboardAdminButtons()); DataBaseContextAdmin.SetCommandId(userId, (int)AdminCommandStep.EditTripColumn); } else if (message == "Назад") { await BotController.Bot.SendTextMessageAsync(userId, "Введите ID рейса для редактирования.", replyMarkup : KeyboardContainer.CreateTwoKeyboardAdminButtons()); DataBaseContextAdmin.SetCommandId(userId, (int)AdminCommandStep.SetTripIdEdit); } else if (message == "Отмена") { Undo(userId); } else { await BotController.Bot.SendTextMessageAsync(userId, "Выберите, что будете редактировать."); } } catch (Exception e) { Console.WriteLine(e); } }