private async Task <DialogTurnResult> AuthenticateAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var cardJson = PrepareCard.ReadCard("passphrase.json"); var cardAttachment = new Attachment() { ContentType = "application/vnd.microsoft.card.adaptive", Content = JsonConvert.DeserializeObject(cardJson), }; var opts = new PromptOptions { Prompt = new Activity { Attachments = new List <Attachment>() { cardAttachment }, Type = ActivityTypes.Message, //Text = "Enter your passphrase", } }; return(await stepContext.PromptAsync(AdaptivePromptId, opts, cancellationToken)); }
public void GetCards() { Get["/"] = o => { try { logger.Info("GET /cards invoked"); var cards = cardsRepository.GetCardsToDisplay().ToList(); PrepareCard.WebPaths(cards); return(Response.AsJson(cards)); } catch (Exception e) { logger.Error(e, "Cannot fetch cards. Server error {0}", e.Message); return(Response.AsJson(new { Message = "Cannot fetch cards. Server error." }, HttpStatusCode.InternalServerError)); } }; Get["/{cardname}"] = o => { try { logger.Info($"GET /cards/{o.cardname} invoked"); var card = cardsRepository.GetCard((string)o.cardname); PrepareCard.WebPaths(card); var detailedCard = new DetailedCardDto { Name = card.Name, BlackMana = card.BlackMana, BlueMana = card.BlueMana, ColorlessMana = card.ColorlessMana, ConvertedManaCost = card.ConvertedManaCost, CreaturePower = card.CreaturePower, Description = card.Description, Expansion = card.Expansion.Name, Flavor = card.Flavor, GreenMana = card.GreenMana, ImagePath = card.ImagePath, LabelPath = card.LabelPath, Loyalty = card.Loyalty, Rarity = card.Rarity, RedMana = card.RedMana, Thoughnes = card.Thoughnes, WhiteMana = card.WhiteMana }; detailedCard.Types = card.Types.Select(x => x.Name).ToList(); detailedCard.Tags = card.Tags.Select(x => x.Name).ToList(); return(Response.AsJson(detailedCard)); } catch (Exception e) { logger.Error(e, "Cannot fetch card. Server error {0}", e.Message); return(Response.AsJson(new { Message = "Cannot fetch cards. Server error." }, HttpStatusCode.InternalServerError)); } }; }