Example #1
0
            public async Task <IActionResult> Execute(Page page)
            {
                var handler = HandlerMethod.Create(Method);

                var arguments = new object[handler.Parameters.Length];

                for (var i = 0; i < handler.Parameters.Length; i++)
                {
                    var parameter = handler.Parameters[i];
                    arguments[i] = await page.Binder.BindModelAsync(page.PageContext, parameter.Type, parameter.DefaultValue, parameter.Name);
                }

                var result = await handler.Execute(page, arguments);

                return(result);
            }
            public async Task <IActionResult> Execute(Page page, object model)
            {
                var handler = HandlerMethod.Create(Method);

                var receiver = Method.DeclaringType.IsAssignableFrom(page.GetType()) ? page : model;

                var arguments = new object[handler.Parameters.Length];

                for (var i = 0; i < handler.Parameters.Length; i++)
                {
                    var parameter = handler.Parameters[i];
                    arguments[i] = await page.Binder.BindModelAsync(page.PageContext, parameter.Type, parameter.DefaultValue, parameter.Name);
                }

                var result = await handler.Execute(receiver, arguments);

                return(result);
            }