adding some views
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using CityInfo.WEB.Models;
|
||||
using CityInfo.WEB.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace CityInfo.WEB.Pages
|
||||
{
|
||||
public partial class CityDetails
|
||||
{
|
||||
[Inject]
|
||||
public ICityDataService CityDataService { get; set; } = default!;
|
||||
[Inject]
|
||||
public IPointOfInterestDataService PointOfInterestDataService { get; set; }
|
||||
[Inject]
|
||||
public NavigationManager NavigationManager { get; set; } = default!;
|
||||
[Parameter]
|
||||
public int CityId { get; set; }
|
||||
public City? City { get; set; }
|
||||
public IEnumerable<PointOfInterest> PointsOfInterest { get; set; } = new List<PointOfInterest>();
|
||||
|
||||
protected async override Task OnInitializedAsync()
|
||||
{
|
||||
City = await CityDataService.GetCity(CityId);
|
||||
if(City == null)
|
||||
{
|
||||
NavigationManager.NavigateTo("/not-found");
|
||||
}
|
||||
PointsOfInterest = await PointOfInterestDataService.GetPointsOfInterest(CityId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user