Ejemplo n.º 1
0
        void ExecuteLoadHistoryItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Expenses = expenseViewModel.GetAllExpenses().ToList();
                Incomes  = incomeViewModel.GetAllIncomes().ToList();
                HistoryItems.Clear();
                HistoryItems.AddRange(Expenses);
                HistoryItems.AddRange(Incomes);
                HistoryItems = HistoryItems.OrderByDescending(x => x.Date).ToList();
                ItemsGrouped = GroupItems();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 2
0
        protected async void LoadItems()
        {
            IsLoading = true;
            StateHasChanged();
            HistoryModel historyModel = await HttpClient.GetFromJsonAsync <HistoryModel>($"/api/history?page={Page}");

            List <IListItem> items = historyModel.GetItems();

            IsEmpty = items.Count() == 0;
            HistoryItems.AddRange(items);
            StateHasChanged();
        }