using Blazorise;
using HeartTrack.Models;
using HeartTrack.Services;
using Microsoft.AspNetCore.Components;

namespace HeartTrack.Pages
{
    partial class Test : ComponentBase
    {
        public IEnumerable<User> Users { get; set; } = new List<User>();

        public string SearchText = "";

        [Inject]
        public IDataService DataService { get; set; }

        [Inject]
        public IWebHostEnvironment WebHostEnvironment { get; set; }

        protected override async Task OnInitializedAsync()
        {
            Users = await DataService.List(1, 50); ;
        }

        List<User> FilteredUsers => Users.Where(
            user => user.Username.ToLower().Contains(SearchText.ToLower())).ToList();
    }
}
