using BlazorAppClean.Models;
using Blazorise.DataGrid;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using BlazorAppClean.Modals;
using BlazorAppClean.Models;
using BlazorAppClean.Services;
using Blazored.LocalStorage;
using Blazored.Modal;
using Blazored.Modal.Services;
using Blazorise.DataGrid;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using Blazorise;

namespace BlazorAppClean.Components
{
    public partial class InventoryComponent
    {
        [Inject]
        public IDataService DataService { get; set; }

        private int totalItem;
        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.getAll();
            totalItem = await DataService.Count();

            StateHasChanged();
        }

    }
}
