Exemplo n.º 1
0
        protected async override Task OnInitializedAsync()
        {
            listCtgr = await CategoryDataService.GetAllCategories();

            listCurr = await CurrencyDataService.GetAllCurrencies();

            Categories = new ObservableCollection <CategoryViewModel>(listCtgr);
            Currencies = new ObservableCollection <CurrencyViewModel>(listCurr);

            if (SelectedExpenseClaimId != 0)
            {
                ronly = true;
                Items = await ItemDataService.GetAllItems(SelectedExpenseClaimId);

                foreach (var it in Items)
                {
                    it.CategoryName = listCtgr.Find(x => x.Id == it.CategoryId).Name;
                    it.CurrencyName = listCurr.Find(x => x.Id == it.CurrencyId).Name;
                    if (it.ItemId == 0)
                    {
                        it.CategoryName = listCtgr[0].Name;
                        it.CurrencyName = listCurr[0].Name;
                    }
                }
            }
        }
Exemplo n.º 2
0
        protected override async Task OnInitializedAsync()
        {
            if (Guid.TryParse(EventId, out SelectedEventId))
            {
                EventDetailViewModel = await EventDataService.GetEventById(SelectedEventId);

                SelectedCategoryId = EventDetailViewModel.CategoryId.ToString();
            }

            var list = await CategoryDataService.GetAllCategories();

            Categories         = new ObservableCollection <CategoryViewModel>(list);
            SelectedCategoryId = Categories.FirstOrDefault().CategoryId.ToString();
        }
        protected override async Task OnInitializedAsync()
        {
            int.TryParse(ItemId, out SelectedItemId);
            var listCtgr = await CategoryDataService.GetAllCategories();

            var listCurr = await CurrencyDataService.GetAllCurrencies();

            Categories = new ObservableCollection <CategoryViewModel>(listCtgr);
            Currencies = new ObservableCollection <CurrencyViewModel>(listCurr);

            if (SelectedItemId > 0)
            {
                ItemDetailViewModel = await ItemDataService.GetItemById(SelectedItemId);

                SelectedExpenseClaimId = ItemDetailViewModel.ExpenseClaimId;
                SelectedCategoryId     = ItemDetailViewModel.CategoryId.ToString();
                SelectedCurrencyId     = ItemDetailViewModel.CurrencyId.ToString();
            }
            else
            {
                SelectedCategoryId = Categories.FirstOrDefault().Id.ToString();
                SelectedCurrencyId = Currencies.FirstOrDefault().Id.ToString();
            }
        }
Exemplo n.º 4
0
 protected async override Task OnInitializedAsync()
 {
     Categories = await CategoryDataService.GetAllCategories();
 }