private async void OnFirstMessage(object sender, MessageEventArgs e) { var user = await _userRepository.GetByTelegramId(e.Message.From.Username); if (user != null) { var presentations = (await _presentationRepository.GetByUser(user.UserName)).Select(x => x.Name); var text = "Please select a presentation:"; List <InlineKeyboardButton> buttons = new List <InlineKeyboardButton>(); foreach (var presentation in presentations) { InlineKeyboardButton button = new InlineKeyboardButton(); button.CallbackData = $"{user.Id}:{presentation}:{0}"; button.Text = presentation; } InlineKeyboardMarkup markup = new InlineKeyboardMarkup(buttons); await _client.SendTextMessageAsync(user.Id, text, replyMarkup : markup); } else { //string text = "Do you want to start receiving current presentation?"; //InlineKeyboardButton button = new InlineKeyboardButton(); //button.CallbackData = $"{user.Id}:{0}:{1}"; //InlineKeyboardMarkup markup = new InlineKeyboardMarkup(button); //await _client.SendTextMessageAsync(e.Message.From.Id, text, replyMarkup: markup); } }
public async Task <ActionResult> GetLectures() { return(Json(await _presentationRepository.GetByUser(User.Identity.Name))); }