first commit
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<h3>Employee Counter</h3>
|
||||
|
||||
|
||||
<h3>There are currently @EmployeeCounter employees working at Bethany's Pie Shop!</h3>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Webshop.App.Services;
|
||||
|
||||
namespace Webshop.App.Components.Widgets
|
||||
{
|
||||
public partial class EmployeeCountWidget
|
||||
{
|
||||
[Inject]
|
||||
public IEmployeeDataService EmployeeDataService { get; set; } = default!;
|
||||
public int EmployeeCounter { get; set; }
|
||||
|
||||
protected async override Task OnInitializedAsync()
|
||||
{
|
||||
EmployeeCounter = await RetrieveNumberOfEmployees();
|
||||
}
|
||||
|
||||
public async Task<int> RetrieveNumberOfEmployees()
|
||||
{
|
||||
var employees = await EmployeeDataService.GetAllEmployees();
|
||||
return employees.Count();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<h3>Inbox</h3>
|
||||
|
||||
@if (@MessageCount > 0)
|
||||
{
|
||||
<h4>You currently have @MessageCount questions from employees!</h4>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h4>No questions from employees! All good!</h4>
|
||||
}
|
||||
|
||||
<br />
|
||||
<br />
|
||||
@@ -0,0 +1,16 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Webshop.App.Components.Widgets
|
||||
{
|
||||
public partial class InboxWidget
|
||||
{
|
||||
[Inject]
|
||||
public ApplicationState? ApplicationState { get; set; }
|
||||
public int MessageCount { get; set; } = 0;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
MessageCount = ApplicationState.NumberOfMessages;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user