示例#1
0
        public IViewComponentResult Invoke(int AgeAbove)
        {
            var emps           = EmployeeFactory.GetEmployees();
            var elderEmployees = emps.Where(emp => emp.DOB.Year <= DateTime.Now.AddYears(-AgeAbove).Year);

            return(View(elderEmployees.ToList()));
        }
示例#2
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
#line 1 "C:\Users\ADMIN\source\repos\CustomTagHelpersDemo\CustomTagHelpersDemo\Views\Home\Index.cshtml"

            ViewData["Title"] = "Home Page";

#line default
#line hidden
            BeginContext(45, 204, true);
            WriteLiteral("\r\n<div class=\"text-center\">\r\n    <h1 class=\"display-4\">Welcome</h1>\r\n    <p>Learn about <a href=\"https://docs.microsoft.com/aspnet/core\">building Web apps with ASP.NET Core</a>.</p>\r\n</div>\r\n\r\n<div>\r\n    ");
            EndContext();
            BeginContext(250, 43, false);
#line 11 "C:\Users\ADMIN\source\repos\CustomTagHelpersDemo\CustomTagHelpersDemo\Views\Home\Index.cshtml"
            Write(await Component.InvokeAsync("AllEmployees"));

#line default
#line hidden
            EndContext();
            BeginContext(293, 12, true);
            WriteLiteral("\r\n</div>\r\n\r\n");
            EndContext();
            BeginContext(305, 33, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("e-mail", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "babc309f9eca353fef7c0f055ae1160a548312d14420", async() => {
            }
                                                                        );
            __CustomTagHelpersDemo_TagHelpers_EMailTagHelper = CreateTagHelper <global::CustomTagHelpersDemo.TagHelpers.EMailTagHelper>();
            __tagHelperExecutionContext.Add(__CustomTagHelpersDemo_TagHelpers_EMailTagHelper);
            __CustomTagHelpersDemo_TagHelpers_EMailTagHelper.MailTo = (string)__tagHelperAttribute_0.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(338, 2, true);
            WriteLiteral("\r\n");
            EndContext();
#line 15 "C:\Users\ADMIN\source\repos\CustomTagHelpersDemo\CustomTagHelpersDemo\Views\Home\Index.cshtml"

            var emps = EmployeeFactory.GetEmployees();

#line default
#line hidden
            BeginContext(396, 35, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("grid", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "babc309f9eca353fef7c0f055ae1160a548312d15847", async() => {
            }
                                                                        );
            __CustomTagHelpersDemo_TagHelpers_GridTagHelper = CreateTagHelper <global::CustomTagHelpersDemo.TagHelpers.GridTagHelper>();
            __tagHelperExecutionContext.Add(__CustomTagHelpersDemo_TagHelpers_GridTagHelper);
#line 18 "C:\Users\ADMIN\source\repos\CustomTagHelpersDemo\CustomTagHelpersDemo\Views\Home\Index.cshtml"
            __CustomTagHelpersDemo_TagHelpers_GridTagHelper.ListToRender = emps;

#line default
#line hidden
            __tagHelperExecutionContext.AddTagHelperAttribute("list-to-render", __CustomTagHelpersDemo_TagHelpers_GridTagHelper.ListToRender, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(431, 4, true);
            WriteLiteral("\r\n\r\n");
            EndContext();
        }
示例#3
0
 //View to be added in Shared-->Components-->AllEmployees
 public IViewComponentResult Invoke()
 {
     return(View(EmployeeFactory.GetEmployees()));
 }