diff --git a/ComponentPractice/ComponentPractice/Components/Layout/NavMenu.razor b/ComponentPractice/ComponentPractice/Components/Layout/NavMenu.razor index 24ba4f8..8b35e8a 100644 --- a/ComponentPractice/ComponentPractice/Components/Layout/NavMenu.razor +++ b/ComponentPractice/ComponentPractice/Components/Layout/NavMenu.razor @@ -37,6 +37,7 @@ + diff --git a/ComponentPractice/ComponentPractice/Components/Pages/DialogCard.razor b/ComponentPractice/ComponentPractice/Components/Pages/DialogCard.razor new file mode 100644 index 0000000..33f2b71 --- /dev/null +++ b/ComponentPractice/ComponentPractice/Components/Pages/DialogCard.razor @@ -0,0 +1,57 @@ +@page "/dialogcard/{EmployeeId}" + +@inject InMemoryData data; +@inject Radzen.DialogService dialogService; + +@rendermode RenderMode.InteractiveServer + +@if (employee is null) +{ + No data +} +else +{ + + + + Employee + @($"{employee.FirstName} {employee.LastName}") + Job Title + @($"{employee.Title} {employee.Job}") + + + + Personal Information + + + Hire Date + @employee.HireDate.ToString("yyyy-MM-dd") + Phone + @employee.Phone + + + Region + @employee.Region + Address + @employee.Address + + + + + + + +} + +@code { + [Parameter] + public int EmployeeId { get; set; } + + Employee employee; + + protected override async Task OnInitializedAsync() + { + var employees = await data.GetFixedEmployeeDataAsync(); + employee = employees.Where(e => e.ID == EmployeeId).FirstOrDefault(); + } +} \ No newline at end of file diff --git a/ComponentPractice/ComponentPractice/Components/Pages/LayoutDialog.razor b/ComponentPractice/ComponentPractice/Components/Pages/LayoutDialog.razor new file mode 100644 index 0000000..8073646 --- /dev/null +++ b/ComponentPractice/ComponentPractice/Components/Pages/LayoutDialog.razor @@ -0,0 +1,54 @@ +@page "/layoutdialog" + +@inject DialogService dialogService; + +@rendermode RenderMode.InteractiveServer + + + Open page as Dialog +
+ +
+ +
+
+ + + Inline Dialog +
+ +
+ +
+
+ +@code { + int employeeId = Random.Shared.Next(1, 100); + + public async Task OpenEmployeeDetail() + { + var result = await dialogService.OpenAsync($"Employee ID {employeeId}", + new Dictionary() { { "EmployeeId", employeeId } }, + new DialogOptions() { Width = "50%", Height = "550px", Resizable = true, Draggable = true }); + + int a = 0; + } + + public async Task ShowInlineDialog() + { + var result = await dialogService.OpenAsync("Simple Inline Dialog", ds => + @ +

Inline Dialog

+
+ This is sample of inline dialog. (Employee ID: @employeeId) +
+ + + + + + + +
); + } +} diff --git a/ComponentPractice/ComponentPractice/Program.cs b/ComponentPractice/ComponentPractice/Program.cs index eef2770..24f1826 100644 --- a/ComponentPractice/ComponentPractice/Program.cs +++ b/ComponentPractice/ComponentPractice/Program.cs @@ -19,12 +19,14 @@ namespace ComponentPractice // Add controllers builder.Services.AddControllers(); - // Add swagger + // Add Swagger builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); + // Add Radzen components builder.Services.AddRadzenComponents(); + // Add Data services builder.Services.AddSingleton(); builder.Services.AddScoped(); builder.Services.AddScoped();