protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { board = new GameBoard(); pdao = new PlayerDAO(ConfigurationManager.ConnectionStrings["myConn"].ConnectionString); string playerName = pdao.GetNamebyEmail(Session["currentEmail"].ToString()); int pid = pdao.GetIdByEmail(Session["currentEmail"].ToString()); player = new ConnectPlayer(pid, playerName, Session["currentEmail"].ToString()); bot = new ConnectBot(null, null); game = new ConnectFour(bot, player, board); tblBoard.GridLines = GridLines.Both; printBoard(); Session.Add("board", board); Session.Add("player", player); Session.Add("bot", bot); Session.Add("game", game); } else { board = (GameBoard)Session["board"]; player = (ConnectPlayer)Session["player"]; bot = (ConnectBot)Session["bot"]; game = (ConnectFour)Session["game"]; } }
public async Task <IActionResult> Post([FromBody] Update update) { //if (Result == null && update.CallbackQuery == null && update.InlineQuery==null) //{ // BotCore = new ProductAddBot(update); // Result = await BotCore.Response(); //} if (update != null && update.CallbackQuery != null && update.CallbackQuery.Data != null && update.InlineQuery == null) { ModuleName = JsonConvert.DeserializeObject <BotCommand>(update.CallbackQuery.Data).M; } if (update.InlineQuery == null) { if (Result == null && ModuleName != null && ModuleName == MainMenuBot.ModuleName || Result == null && ModuleName == null) { BotCore = new MainMenuBot(update); Result = await BotCore.Response(); } if (Result == null && ModuleName != null && ModuleName == ConnectBot.ModuleName || Result == null && ModuleName == null) { BotCore = new ConnectBot(update); Result = await BotCore.Response(); } } //делаем так что бы наше приложние всегда отвечало телеграму ОК. //В противном случаем телеграм так и будет слать нам это сообщения в ожиданиее ответа ОК if (Result == null || Result != null) { Result = Ok(); } return(Result); }