Exemplo n.º 1
0
        // [HandleInitiation]
        public async Task <ProgrammableServiceResponse> TestWebCollection()
        {
            var collection = new Dictionary <string, string>
            {
                { "iPhone 6s", "iphone_6_s" }, //take note: the value could also be a JSON
                { "iPhone 7", "iphone_7" },
                { "iPhone 7+", "iphone_7_p" },
                { "iPhone 8", "iphone_8" },
                { "iPhone X", "iphone_10" },
                { "iPhone Xs", "iphone_10_s" },
                { "iPhone 11", "iphone_11" },
                { "iPhone 11 Pro", "iphone_11_pro" },
                { "Apple Watch Series 3", "iwatch_3" },
                { "Apple Watch Series 4", "iwatch_4" },
                { "Apple Watch Series 5", "iwatch_5" },
                { "Macbook 2019 model", "macbook" },
            };

            FormData = new Dictionary <string, string>();
            var form = new Form
            {
                Title  = "Select Bundle",
                Action = nameof(Confirmation),
                Data   = FormData,
            };

            form.AddInput(Input.New("bundle-chosen", "Select Bundle"));
            return(await RenderForm(form,
                                    collection.Select(b => new ProgrammableServicesResponseData($"{b.Key}", b.Value, decimal.Zero))
                                    .ToList(), null, "Select Bundle", ProgrammableServiceDataTypes.Select));
        }