diff --git a/.vs/Blazor/v17/.suo b/.vs/Blazor/v17/.suo
index e22e6e7..8e4b604 100644
Binary files a/.vs/Blazor/v17/.suo and b/.vs/Blazor/v17/.suo differ
diff --git a/.vs/BlazorApp1/DesignTimeBuild/.dtbcache.v2 b/.vs/BlazorApp1/DesignTimeBuild/.dtbcache.v2
index e6e52b7..375cd2e 100644
Binary files a/.vs/BlazorApp1/DesignTimeBuild/.dtbcache.v2 and b/.vs/BlazorApp1/DesignTimeBuild/.dtbcache.v2 differ
diff --git a/.vs/BlazorApp1/FileContentIndex/0a4b8764-b4b2-4dac-8581-8b63cebf66cc.vsidx b/.vs/BlazorApp1/FileContentIndex/0a4b8764-b4b2-4dac-8581-8b63cebf66cc.vsidx
deleted file mode 100644
index e749c44..0000000
Binary files a/.vs/BlazorApp1/FileContentIndex/0a4b8764-b4b2-4dac-8581-8b63cebf66cc.vsidx and /dev/null differ
diff --git a/.vs/BlazorApp1/FileContentIndex/1e156933-138c-49d2-a3b1-a1f6f13abf69.vsidx b/.vs/BlazorApp1/FileContentIndex/1e156933-138c-49d2-a3b1-a1f6f13abf69.vsidx
new file mode 100644
index 0000000..a942a1c
Binary files /dev/null and b/.vs/BlazorApp1/FileContentIndex/1e156933-138c-49d2-a3b1-a1f6f13abf69.vsidx differ
diff --git a/.vs/BlazorApp1/FileContentIndex/62384a59-a85a-478f-9517-cb7fdb4f2c19.vsidx b/.vs/BlazorApp1/FileContentIndex/62384a59-a85a-478f-9517-cb7fdb4f2c19.vsidx
new file mode 100644
index 0000000..578dd39
Binary files /dev/null and b/.vs/BlazorApp1/FileContentIndex/62384a59-a85a-478f-9517-cb7fdb4f2c19.vsidx differ
diff --git a/.vs/BlazorApp1/FileContentIndex/81089cb1-7824-4822-89ae-345e9fa36bf5.vsidx b/.vs/BlazorApp1/FileContentIndex/81089cb1-7824-4822-89ae-345e9fa36bf5.vsidx
new file mode 100644
index 0000000..37538ae
Binary files /dev/null and b/.vs/BlazorApp1/FileContentIndex/81089cb1-7824-4822-89ae-345e9fa36bf5.vsidx differ
diff --git a/.vs/BlazorApp1/FileContentIndex/b13fb56c-5cd0-48a8-b071-6b8c4fd80768.vsidx b/.vs/BlazorApp1/FileContentIndex/b13fb56c-5cd0-48a8-b071-6b8c4fd80768.vsidx
deleted file mode 100644
index 5bee6c7..0000000
Binary files a/.vs/BlazorApp1/FileContentIndex/b13fb56c-5cd0-48a8-b071-6b8c4fd80768.vsidx and /dev/null differ
diff --git a/.vs/BlazorApp1/FileContentIndex/fd93e75d-0f8a-449f-809f-7effcf05ac9f.vsidx b/.vs/BlazorApp1/FileContentIndex/fd93e75d-0f8a-449f-809f-7effcf05ac9f.vsidx
new file mode 100644
index 0000000..d87ad42
Binary files /dev/null and b/.vs/BlazorApp1/FileContentIndex/fd93e75d-0f8a-449f-809f-7effcf05ac9f.vsidx differ
diff --git a/.vs/BlazorApp1/v17/.suo b/.vs/BlazorApp1/v17/.suo
index 65222f3..166ae8e 100644
Binary files a/.vs/BlazorApp1/v17/.suo and b/.vs/BlazorApp1/v17/.suo differ
diff --git a/.vs/ProjectEvaluation/blazorapp1.metadata.v2 b/.vs/ProjectEvaluation/blazorapp1.metadata.v2
index ad2ed6e..dbc3d51 100644
Binary files a/.vs/ProjectEvaluation/blazorapp1.metadata.v2 and b/.vs/ProjectEvaluation/blazorapp1.metadata.v2 differ
diff --git a/.vs/ProjectEvaluation/blazorapp1.projects.v2 b/.vs/ProjectEvaluation/blazorapp1.projects.v2
index 7459264..83dba5b 100644
Binary files a/.vs/ProjectEvaluation/blazorapp1.projects.v2 and b/.vs/ProjectEvaluation/blazorapp1.projects.v2 differ
diff --git a/BlazorApp1/App.razor b/BlazorApp1/App.razor
index b0cd24a..6346f35 100644
--- a/BlazorApp1/App.razor
+++ b/BlazorApp1/App.razor
@@ -1,12 +1,14 @@
-
-
-
-
-
-
- Not found
-
- Sorry, there's nothing at this address.
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+ Not found
+
+ Sorry, there's nothing at this address.
+
+
+
+
\ No newline at end of file
diff --git a/BlazorApp1/BlazorApp1.csproj b/BlazorApp1/BlazorApp1.csproj
index 40bd5d5..fe9cd17 100644
--- a/BlazorApp1/BlazorApp1.csproj
+++ b/BlazorApp1/BlazorApp1.csproj
@@ -7,11 +7,12 @@
-
+
-
-
-
+
+
+
+
diff --git a/BlazorApp1/Components/Card.razor b/BlazorApp1/Components/Card.razor
new file mode 100644
index 0000000..6e63d52
--- /dev/null
+++ b/BlazorApp1/Components/Card.razor
@@ -0,0 +1,7 @@
+
Card
+@typeparam TItem
+
+ @CardHeader(Item)
+ @CardBody(Item)
+ @CardFooter
+
\ No newline at end of file
diff --git a/BlazorApp1/Components/Card.razor.cs b/BlazorApp1/Components/Card.razor.cs
new file mode 100644
index 0000000..5deaf73
--- /dev/null
+++ b/BlazorApp1/Components/Card.razor.cs
@@ -0,0 +1,19 @@
+using Microsoft.AspNetCore.Components;
+
+namespace BlazorApp1.Components
+{
+ public partial class Card
+ {
+ [Parameter]
+ public RenderFragment CardBody { get; set; }
+
+ [Parameter]
+ public RenderFragment CardFooter { get; set; }
+
+ [Parameter]
+ public RenderFragment CardHeader { get; set; }
+
+ [Parameter]
+ public TItem Item { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BlazorApp1/Controllers/CultureController.cs b/BlazorApp1/Controllers/CultureController.cs
new file mode 100644
index 0000000..99ffb15
--- /dev/null
+++ b/BlazorApp1/Controllers/CultureController.cs
@@ -0,0 +1,34 @@
+using Microsoft.AspNetCore.Localization;
+using Microsoft.AspNetCore.Mvc;
+
+namespace BlazorApp1.Controllers
+{
+ ///
+ /// The culture controller.
+ ///
+ [Route("[controller]/[action]")]
+ public class CultureController : Controller
+ {
+ ///
+ /// Sets the culture.
+ ///
+ /// The culture.
+ /// The redirect URI.
+ ///
+ /// The action result.
+ ///
+ public IActionResult SetCulture(string culture, string redirectUri)
+ {
+ if (culture != null)
+ {
+ // Define a cookie with the selected culture
+ this.HttpContext.Response.Cookies.Append(
+ CookieRequestCultureProvider.DefaultCookieName,
+ CookieRequestCultureProvider.MakeCookieValue(
+ new RequestCulture(culture)));
+ }
+
+ return this.LocalRedirect(redirectUri);
+ }
+ }
+}
diff --git a/BlazorApp1/Modals/DeleteConfirmation.razor b/BlazorApp1/Modals/DeleteConfirmation.razor
new file mode 100644
index 0000000..b565665
--- /dev/null
+++ b/BlazorApp1/Modals/DeleteConfirmation.razor
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/BlazorApp1/Modals/DeleteConfirmation.razor.cs b/BlazorApp1/Modals/DeleteConfirmation.razor.cs
new file mode 100644
index 0000000..21b35b1
--- /dev/null
+++ b/BlazorApp1/Modals/DeleteConfirmation.razor.cs
@@ -0,0 +1,37 @@
+using BlazorApp1.Sevices;
+using Blazored.Modal;
+using Blazored.Modal.Services;
+using Microsoft.AspNetCore.Components;
+
+namespace BlazorApp1.Modals
+{
+ public partial class DeleteConfirmation
+ {
+ [CascadingParameter]
+ public BlazoredModalInstance ModalInstance { get; set; }
+
+ [Inject]
+ public IDataService DataService { get; set; }
+
+ [Parameter]
+ public int Id { get; set; }
+
+ private Item item = new Item();
+
+ protected override async Task OnInitializedAsync()
+ {
+ // Get the item
+ item = await DataService.GetById(Id);
+ }
+
+ void ConfirmDelete()
+ {
+ ModalInstance.CloseAsync(ModalResult.Ok(true));
+ }
+
+ void Cancel()
+ {
+ ModalInstance.CancelAsync();
+ }
+ }
+}
diff --git a/BlazorApp1/Models/Cake.cs b/BlazorApp1/Models/Cake.cs
new file mode 100644
index 0000000..2b1bde1
--- /dev/null
+++ b/BlazorApp1/Models/Cake.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace BlazorApp1.Models
+{
+ public class Cake
+ {
+ public int Id { get; set; }
+ public string Name { get; set; }
+ public decimal Cost { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BlazorApp1/Pages/Index.razor b/BlazorApp1/Pages/Index.razor
index b1a9fbd..434eee8 100644
--- a/BlazorApp1/Pages/Index.razor
+++ b/BlazorApp1/Pages/Index.razor
@@ -1,4 +1,6 @@
@page "/"
+@using System.Globalization
+@using Blazorise
Index
@@ -7,3 +9,26 @@
Welcome to your new app.
+
+
+ CurrentCulture: @CultureInfo.CurrentCulture
+
+
+
+
+
+
+
+
+
@context.Name
+
$ @context.Cost
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BlazorApp1/Pages/Index.razor.cs b/BlazorApp1/Pages/Index.razor.cs
new file mode 100644
index 0000000..a7de0b4
--- /dev/null
+++ b/BlazorApp1/Pages/Index.razor.cs
@@ -0,0 +1,14 @@
+using BlazorApp1.Models;
+
+namespace BlazorApp1.Pages
+{
+ public partial class Index
+ {
+ private Cake CakeItem = new Cake
+ {
+ Id = 1,
+ Name = "Black Forest",
+ Cost = 50
+ };
+ }
+}
diff --git a/BlazorApp1/Pages/List.razor b/BlazorApp1/Pages/List.razor
index c35b8d1..e1ec256 100644
--- a/BlazorApp1/Pages/List.razor
+++ b/BlazorApp1/Pages/List.razor
@@ -1,6 +1,7 @@
@page "/List"
+
+@Localizer["Title"]
-List
diff --git a/BlazorApp1/Pages/List.razor.cs b/BlazorApp1/Pages/List.razor.cs
index e9a5cc3..3b27a7a 100644
--- a/BlazorApp1/Pages/List.razor.cs
+++ b/BlazorApp1/Pages/List.razor.cs
@@ -1,13 +1,19 @@
-using BlazorApp1.Sevices;
+using BlazorApp1.Modals;
+using BlazorApp1.Sevices;
using Blazored.LocalStorage;
+using Blazored.Modal;
+using Blazored.Modal.Services;
using Blazorise.DataGrid;
using Microsoft.AspNetCore.Components;
-//
+using Microsoft.Extensions.Localization;
namespace BlazorApp1.Pages
{
public partial class List
{
+ [Inject]
+ public IStringLocalizer Localizer { get; set; }
+
private List- items;
private int totalItem;
@@ -18,6 +24,12 @@ namespace BlazorApp1.Pages
[Inject]
public IWebHostEnvironment WebHostEnvironment { get; set; }
+ [Inject]
+ public NavigationManager NavigationManager { get; set; }
+
+ [CascadingParameter]
+ public IModalService Modal { get; set; }
+
private async Task OnReadData(DataGridReadDataEventArgs
- e)
{
if (e.CancellationToken.IsCancellationRequested)
@@ -32,9 +44,23 @@ namespace BlazorApp1.Pages
}
}
- private void OnDelete(int id)
+ private async void OnDelete(int id)
{
+ var parameters = new ModalParameters();
+ parameters.Add(nameof(Item.Id), id);
+
+ var modal = Modal.Show("Delete Confirmation", parameters);
+ var result = await modal.Result;
+
+ if (result.Cancelled)
+ {
+ return;
+ }
+
+ await DataService.Delete(id);
+ // Reload the page
+ NavigationManager.NavigateTo("list", true);
}
}
diff --git a/BlazorApp1/Pages/_Layout.cshtml b/BlazorApp1/Pages/_Layout.cshtml
index 3ea60b9..a0d8a2b 100644
--- a/BlazorApp1/Pages/_Layout.cshtml
+++ b/BlazorApp1/Pages/_Layout.cshtml
@@ -28,10 +28,12 @@
+
+