using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using BlazorServer.Data;

namespace BlazorServer.Pages
{
    // Ta klasa nazywa się zupełnie inaczej niż plik Razor (nawet jeśli ma taką samą nazwę).
    public class FetchDataWithInheritsModel:ComponentBase
    {
        [Inject]
        public WeatherForecastService ForecastService { get; set; }
        protected WeatherForecast[] forecasts;

        protected override async Task OnInitializedAsync()
        {
            forecasts = await ForecastService.GetForecastAsync(DateOnly.FromDateTime(DateTime.Now));
        }
    }

}
