diff --git a/ValblazeProject/Models/Item.cs b/ValblazeProject/Models/Item.cs new file mode 100644 index 0000000..975b30a --- /dev/null +++ b/ValblazeProject/Models/Item.cs @@ -0,0 +1,15 @@ +namespace ValblazeProject.Models +{ + public class Item + { + public int Id { get; set; } + public string DisplayName { get; set; } + public string Name { get; set; } + public int StackSize { get; set; } + public int MaxDurability { get; set; } + public List EnchantCategories { get; set; } + public List RepairWith { get; set; } + public DateTime CreatedDate { get; set; } + public DateTime? UpdatedDate { get; set; } + } +} diff --git a/ValblazeProject/Pages/Episodes.razor b/ValblazeProject/Pages/Episodes.razor new file mode 100644 index 0000000..14abb26 --- /dev/null +++ b/ValblazeProject/Pages/Episodes.razor @@ -0,0 +1,22 @@ +@page "/episodes" +@layout DoctorWhoLayout + +

Episodes

+ + \ No newline at end of file diff --git a/ValblazeProject/Pages/List.razor b/ValblazeProject/Pages/List.razor new file mode 100644 index 0000000..5badf11 --- /dev/null +++ b/ValblazeProject/Pages/List.razor @@ -0,0 +1,34 @@ +@page "/list" + +

List

+ +@if (items != null) +{ + + + + + + + + + + + + + + @foreach (var item in items) + { + + + + + + + + + + } + +
IdDisplay NameStack SizeMaximum DurabilityEnchant CategoriesRepair WithCreated Date
@item.Id@item.DisplayName@item.StackSize@item.MaxDurability@(string.Join(", ", item.EnchantCategories))@(string.Join(", ", item.RepairWith))@item.CreatedDate.ToShortDateString()
+} \ No newline at end of file diff --git a/ValblazeProject/Pages/List.razor.cs b/ValblazeProject/Pages/List.razor.cs new file mode 100644 index 0000000..95425af --- /dev/null +++ b/ValblazeProject/Pages/List.razor.cs @@ -0,0 +1,21 @@ +using Microsoft.AspNetCore.Components; +using ValblazeProject.Models; + +namespace ValblazeProject.Pages +{ + public partial class List + { + private Item[] items; + + [Inject] + public HttpClient Http { get; set; } + + [Inject] + public NavigationManager NavigationManager { get; set; } + + protected override async Task OnInitializedAsync() + { + items = await Http.GetFromJsonAsync($"{NavigationManager.BaseUri}fake-data.json"); + } + } +} diff --git a/ValblazeProject/Pages/Llist.razor b/ValblazeProject/Pages/Llist.razor deleted file mode 100644 index 316cd87..0000000 --- a/ValblazeProject/Pages/Llist.razor +++ /dev/null @@ -1,5 +0,0 @@ -

list

- -@code { - -} diff --git a/ValblazeProject/Pages/Llist.razor.cs b/ValblazeProject/Pages/Llist.razor.cs deleted file mode 100644 index 2c53505..0000000 --- a/ValblazeProject/Pages/Llist.razor.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace ValblazeProject.Pages -{ - public class List - { - } -} diff --git a/ValblazeProject/Program.cs b/ValblazeProject/Program.cs index 7703d96..562c206 100644 --- a/ValblazeProject/Program.cs +++ b/ValblazeProject/Program.cs @@ -9,6 +9,10 @@ builder.Services.AddRazorPages(); builder.Services.AddServerSideBlazor(); builder.Services.AddSingleton(); +builder.Services.AddSingleton(); +builder.Services.AddHttpClient(); + + var app = builder.Build(); // Configure the HTTP request pipeline. @@ -29,3 +33,4 @@ app.MapBlazorHub(); app.MapFallbackToPage("/_Host"); app.Run(); + diff --git a/ValblazeProject/Shared/DoctorWhoLayout.razor b/ValblazeProject/Shared/DoctorWhoLayout.razor new file mode 100644 index 0000000..b64449c --- /dev/null +++ b/ValblazeProject/Shared/DoctorWhoLayout.razor @@ -0,0 +1,23 @@ +@inherits LayoutComponentBase + +
+

Doctor Who™ Episode Database

+
+ + + +@Body + +
+ @TrademarkMessage +
+ +@code { + public string TrademarkMessage { get; set; } = + "Doctor Who is a registered trademark of the BBC. " + + "https://www.doctorwho.tv/"; +} \ No newline at end of file diff --git a/ValblazeProject/Shared/NavMenu.razor b/ValblazeProject/Shared/NavMenu.razor index 53eb91c..54297f0 100644 --- a/ValblazeProject/Shared/NavMenu.razor +++ b/ValblazeProject/Shared/NavMenu.razor @@ -9,6 +9,11 @@