protected async Task RemoveFromRecentList(Household household) { RecentHouseholds.Remove(household); await LocalStorageHouseholdService.RemoveHousehold(household.HouseholdId); StateHasChanged(); }
private async Task FetchRecentHouseholds() { var households = await LocalStorageHouseholdService.GetLocallyStoredHouseholds(); foreach (var household in households) { RecentHouseholds.Add(household); } }
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}"); } }