public async Task GoNextPortfolioStep(UserWrapper user) { var query = user.LastCallBackQuery.Data.Replace(InlinePrefixKeys.PortfolioKey, ""); if (query == Localization.AddProduct) { } else if (query == Localization.ShowProducts) { await Bot.SendChatActionAsync(user.LastCallBackQuery.Message.Chat.Id, ChatAction.UploadPhoto); var pids = ProductManager.GetProductsId(); var product = ProductManager.GetProduct(pids.Length / 2); var count = ProductManager.GetProductsId().Length; await SendImageAsync(user, product.Title, product.Descriptin, product.Image, KeyboardCollection.ProductInlineKeyboard(product.Id)); user.LastMessageQuery = await Bot.SendTextMessageAsync(user.LastCallBackQuery.Message.Chat.Id, Localization.GotoNextOrPreviousProducts, ParseMode.Markdown, replyMarkup : KeyboardCollection.ProductTrackBarInlineKeyboard(pids.Length / 2, count)); } else if (query == Localization.EditProduct) { } else if (query == Localization.DeleteProduct) { } else if (query.StartsWith(Localization.Previous)) { if (int.TryParse(query.Replace(Localization.Previous, "").Replace("_", ""), out int currentProductIndex) && currentProductIndex > 0) { await Bot.SendChatActionAsync(user.LastCallBackQuery.Message.Chat.Id, ChatAction.UploadPhoto); var pids = ProductManager.GetProductsId(); var product = ProductManager.GetProduct(pids[currentProductIndex - 1]); await DeleteMessageAsync(user.LastCallBackQuery.Message); await SendImageAsync(user, product.Title, product.Descriptin, product.Image, KeyboardCollection.ProductInlineKeyboard(product.Id)); user.LastMessageQuery = await Bot.SendTextMessageAsync(user.LastCallBackQuery.Message.Chat.Id, Localization.GotoNextOrPreviousProducts, ParseMode.Markdown, replyMarkup : KeyboardCollection.ProductTrackBarInlineKeyboard(currentProductIndex - 1, pids.Length)); } } else if (query.StartsWith(Localization.Next)) { if (int.TryParse(query.Replace(Localization.Next, "").Replace("_", ""), out int currentProductIndex) && currentProductIndex > 0) { await Bot.SendChatActionAsync(user.LastCallBackQuery.Message.Chat.Id, ChatAction.UploadPhoto); var pids = ProductManager.GetProductsId(); if (pids.Length > currentProductIndex + 1) { var product = ProductManager.GetProduct(pids[currentProductIndex + 1]); await DeleteMessageAsync(user.LastCallBackQuery.Message); await SendImageAsync(user, product.Title, product.Descriptin, product.Image, KeyboardCollection.ProductInlineKeyboard(product.Id)); user.LastMessageQuery = await Bot.SendTextMessageAsync(user.LastCallBackQuery.Message.Chat.Id, Localization.GotoNextOrPreviousProducts, ParseMode.Markdown, replyMarkup : KeyboardCollection.ProductTrackBarInlineKeyboard(currentProductIndex + 1, pids.Length)); } } } await AnswerCallbackQueryAsync(user); }