Example #1
0
        public void UpdateOtherExpenses([FromBody] OtherExpensesViewModel otherExpensesData)
        {
            List <OtherExpensesItem> otherExpensesItems = new List <OtherExpensesItem>();

            otherExpensesItems.AddRange(otherExpensesData.otherExpensesItems);


            List <OtherExpensesInfo> otherExpensesList = (_unitofWork.OtherExpensesRepository.GetOtherExpensesForRequest(otherExpensesItems.First().ReimbursementInfoId));

            foreach (var item in otherExpensesItems)
            {
                var refItem = otherExpensesList.FirstOrDefault(i => i.ReimbursementInfoId == item.ReimbursementInfoId);
                if (refItem != null)
                {
                    refItem.Date             = item.Date;
                    refItem.Currency         = item.Currency;
                    refItem.AmountSpent      = item.AmountSpent;
                    refItem.Eligibility      = item.Eligibility;
                    refItem.NatureofExpense  = item.NatureofExpense;
                    refItem.SupportbyVoucher = item.SupportbyVoucher;
                }
            }

            _unitofWork.Complete();
        }
Example #2
0
        public void AddOtherExpenses([FromBody] OtherExpensesViewModel otherExpensesViewModel)
        {
            List <OtherExpensesInfo> _otherExpensesItems = _mapper.Map <List <OtherExpensesItem>, List <OtherExpensesInfo> >(otherExpensesViewModel.otherExpensesItems);

            _unitofWork.OtherExpensesRepository.AddOtherExpensesOptions(_otherExpensesItems);
            _unitofWork.Complete();
        }
Example #3
0
        public OtherExpensesViewModel GetOtherExpensesForRequest(int id)
        {
            OtherExpensesViewModel otherExpensesOptions = new OtherExpensesViewModel();

            otherExpensesOptions.otherExpensesItems = _mapper.Map <List <OtherExpensesInfo>, List <OtherExpensesItem> >(_unitofWork.OtherExpensesRepository.GetOtherExpensesForRequest(id));

            return(otherExpensesOptions);
        }