public async Task OnAddingTag(ApplicationContext context, CallbackQuery query, TelegramBotClient client) { int tagId = Convert.ToInt32(query.Data.Split('-')[1]); int parentTagId = context.Tags.Where(t => t.TagId == tagId).Select(e => e.ParentTagID).First(); List <Tag> childTags = context.Tags.Where(x => x.Level == 2 && x.ParentTagID == parentTagId).ToList(); User user = await UserDB.GetUserByChatId(context, query.From.Id); TelegramInlineKeyboard inline = new TelegramInlineKeyboard(); bool added = await UserDB.AddDeleteTag(context, query.From.Id, tagId); string ch = ""; bool ex; foreach (var tag in childTags) { if (tag.TagId != tagId) { ex = user.UserTags.FirstOrDefault(e => e.TagId == tag.TagId) != null; } else { ex = added; } if (ex) { ch = Utils.GetCheckmark(); } else { ch = ""; } inline.AddTextRow($"{tag.Name} {ch}").AddCallbackRow($"tag-{tag.TagId}"); } // await client.EditMessageTextAsync(query.From.Id, query.Message.MessageId, "meow"); await client.EditMessageReplyMarkupAsync(query.From.Id, query.Message.MessageId, replyMarkup : inline.Markup); }