Beispiel #1
0
        public async Task <InventoryView> SetViewDependencies(InventoryView view)
        {
            Task <ItemMaster>     itemMasterTask = _unitOfWork.itemMasterRepository.GetEntityById(view.ItemId);
            Task <ChartOfAccount> accountTask    = _unitOfWork.chartOfAccountRepository.GetEntityById(view.DistributionAccountId);

            Task.WaitAll(itemMasterTask, accountTask);

            ItemMaster     itemMaster          = await itemMasterTask;
            ChartOfAccount distributionAccount = await accountTask;

            FluentItemMaster     fluentItemMaster     = new FluentItemMaster(_unitOfWork);
            FluentChartOfAccount fluentChartOfAccount = new FluentChartOfAccount(_unitOfWork);


            if (itemMaster != null)
            {
                view.ItemMasterView = await fluentItemMaster.Query().MapToView(itemMaster);
            }
            if (distributionAccount != null)
            {
                view.DistributionAccountView = await fluentChartOfAccount.Query().MapToView(await accountTask);
            }
            return(view);
        }