first commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using BethanysPieShopHRM.Shared.Domain;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Webshop.App.Services;
|
||||
|
||||
namespace Webshop.App.Pages
|
||||
{
|
||||
public partial class EmployeeDetails
|
||||
{
|
||||
[Inject]
|
||||
public NavigationManager NavigationManager { get; set; } = default!;
|
||||
[Inject]
|
||||
public IEmployeeDataService? EmployeeDataService { get; set; }
|
||||
[Parameter]
|
||||
public int EmployeeId { get; set; }
|
||||
|
||||
public Employee? Employee { get; set; } = default;
|
||||
|
||||
protected async override Task OnInitializedAsync()
|
||||
{
|
||||
Employee = await RetrieveEmployee();
|
||||
}
|
||||
|
||||
public async Task<Employee?> RetrieveEmployee()
|
||||
{
|
||||
var employeeFound = await EmployeeDataService.GetEmployeeDetails(EmployeeId);
|
||||
if(employeeFound == null)
|
||||
{
|
||||
NavigationManager.NavigateTo("/not-found");
|
||||
}
|
||||
return employeeFound;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user