Esempio n. 1
0
        public ApiDisbursementListView GetByID(int id)
        {
            DisbursementList        dl = uow.DisbursementListRepository.Get(filter: x => x.ID == id, includeProperties: "Department, CreatedByStaff, RepliedByStaff, Department.CollectionPoint").FirstOrDefault();
            ApiDisbursementListView apiDisbursementListView = new ApiDisbursementListView(dl);

            return(apiDisbursementListView);
        }
Esempio n. 2
0
        public bool CompleteDisbursement(ApiDisbursementListView apiDisbursementListView)
        {
            bool saved = false;

            // validation of model etc

            foreach (ApiTransactionItemView ati in apiDisbursementListView.transactionItemViewList)
            {
                TransactionItem ti = uow.TransactionItemRepository.GetByID(Guid.Parse(ati.ID));
                if (ti == null)
                {
                    return(saved);
                }
                ti.TakeOverQty = ati.TakeOverQty;
                uow.TransactionItemRepository.Update(ti);
            }
            DisbursementList disbursementList = uow.DisbursementListRepository.GetByID(int.Parse(apiDisbursementListView.ID));

            disbursementList.CompletedWithDate();
            uow.Save();
            saved = true;
            return(saved);
        }