using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using ProjetBlazor.Components;
using ProjetBlazor.Models;
using ProjetBlazor.Services;
using System.Collections.Generic;

namespace ProjetBlazor.Pages
{
    public partial class Inventory
    {
        [Inject]
        public IDataService DataService { get; set; }

        public List<Item> Items { get; set; } = new List<Item>();

        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            _ = base.OnAfterRenderAsync(firstRender);

            if (!firstRender)
            {
                return;
            }

            Items = await DataService.List(0, await DataService.Count());

            StateHasChanged();
        }
    }
}
