Skip to content

Commit

Permalink
Repair Dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Hijtec committed Nov 20, 2024
1 parent 9b42124 commit fe980f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
8 changes: 1 addition & 7 deletions ToDoList/src/ToDoList.Frontend/Clients/ToDoItemsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@ namespace ToDoList.Frontend.Clients;
using ToDoList.Domain.DTOs;
using ToDoList.Frontend.Views;

public class ToDoItemsClient : IToDoItemsClient
public class ToDoItemsClient(HttpClient httpClient) : IToDoItemsClient
{
private readonly HttpClient httpClient;
public ToDoItemsClient(HttpClient httpClient)
{
httpClient = httpClient;
}

public List<ToDoItemView> ReadItems()
{
var toDoItemsView = new List<ToDoItemView>();
Expand Down
11 changes: 8 additions & 3 deletions ToDoList/src/ToDoList.Frontend/Components/Dashboard.razor
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,19 @@

@code
{
private List<ToDoItemView> toDoItems = ToDoItemsClient.ReadItems();
protected override void OnInitialized()
{
toDoItems = ToDoItemsClient.ReadItems();
}

private List<ToDoItemView>? toDoItems;

public void OrderByName()
{
toDoItems = toDoItems.OrderBy(item => item.Name).ToList();
toDoItems = toDoItems?.OrderBy(item => item.Name).ToList();
}
public void OrderById()
{
toDoItems = toDoItems.OrderBy(item => item.ToDoItemId).ToList();
toDoItems = toDoItems?.OrderBy(item => item.ToDoItemId).ToList();
}
}

0 comments on commit fe980f6

Please sign in to comment.