Exemple #1
0
        protected async Task RemoveFromRecentList(Household household)
        {
            RecentHouseholds.Remove(household);
            await LocalStorageHouseholdService.RemoveHousehold(household.HouseholdId);

            StateHasChanged();
        }
Exemple #2
0
        private async Task FetchRecentHouseholds()
        {
            var households = await LocalStorageHouseholdService.GetLocallyStoredHouseholds();

            foreach (var household in households)
            {
                RecentHouseholds.Add(household);
            }
        }
Exemple #3
0
        protected async Task OnSearchForCode()
        {
            var alreadyAddedHousehold = RecentHouseholds.FirstOrDefault(h => h.HouseholdCode == HouseholdCode);

            if (alreadyAddedHousehold != null)
            {
                NavigateToHousehold(alreadyAddedHousehold.HouseholdId);
            }

            var household = await HouseholdDataService.GetHouseholdByCode(HouseholdCode);

            var searchSuccessful = household != null;

            if (searchSuccessful)
            {
                RecentHouseholds.Insert(0, household);
                NavigateToHousehold(household.HouseholdId);
            }
            else
            {
                ToastService.ShowError($"Could not find any household with code {HouseholdCode}");
            }
        }