コード例 #1
0
        public async Task Update(OtherExpensesBll elementToUpdate)
        {
            otherExpenses otherExpenses = Mapper.Map <OtherExpensesBll, otherExpenses>(elementToUpdate);

            _unitOfWork.otherExpensesUnitOfWork.Update(otherExpenses);
            await _unitOfWork.Save();
        }
コード例 #2
0
        public async Task Insert(OtherExpensesBll element)
        {
            otherExpenses otherExpenses = Mapper.Map <OtherExpensesBll, otherExpenses>(element);

            _unitOfWork.otherExpensesUnitOfWork.Insert(otherExpenses);
            await _unitOfWork.Save();
        }
コード例 #3
0
        public async Task <ActionResult> Edit([Bind(Include = "idOtherExpenses,nameExpenses,amount,dateExpenses,expenseCategoryId")] OtherExpensesView otherExpensesView)
        {
            if (ModelState.IsValid)
            {
                OtherExpensesBll otherExpenses = Mapper.Map <OtherExpensesView, OtherExpensesBll>(otherExpensesView);
                await _otherExpenses.Insert(otherExpenses);

                return(RedirectToAction("Index"));
            }

            ViewBag.Category = new SelectList(await _expenseCategory.GetTableAll(), "idExpenseCategory", "name");
            return(View(otherExpensesView));
        }
コード例 #4
0
        public async Task SaveExpenses(AllExpensesBll allExpenses)
        {
            if (allExpenses.expenseCategoryId == 2 || allExpenses.expenseCategoryId == 3)
            {
                CostsCarWashAndDeteylingBll costsCarWash = new CostsCarWashAndDeteylingBll();

                costsCarWash.nameExpenses      = allExpenses.nameExpenses;
                costsCarWash.expenseCategoryId = allExpenses.expenseCategoryId;
                costsCarWash.dateExpenses      = allExpenses.dateExpenses;
                costsCarWash.amount            = allExpenses.amount;
                costsCarWash.typeServicesId    = allExpenses.typeServicesId;

                await _costsCarWashAndDeteyling.Insert(costsCarWash);
            }
            else if (allExpenses.expenseCategoryId == 5)
            {
                UtilityCostsBll utilityCosts = new UtilityCostsBll();

                utilityCosts.indicationCounter      = allExpenses.indicationCounter;
                utilityCosts.amount                 = allExpenses.amount;
                utilityCosts.dateExpenses           = allExpenses.dateExpenses;
                utilityCosts.expenseCategoryId      = allExpenses.expenseCategoryId;
                utilityCosts.utilityCostsCategoryId = allExpenses.utilityCostsCategoryId;

                await _utilityCosts.Insert(utilityCosts);
            }
            else if (allExpenses.expenseCategoryId == 6)
            {
                OtherExpensesBll otherExpenses = new OtherExpensesBll();

                otherExpenses.nameExpenses      = allExpenses.nameExpenses;
                otherExpenses.amount            = allExpenses.amount;
                otherExpenses.dateExpenses      = allExpenses.dateExpenses;
                otherExpenses.expenseCategoryId = allExpenses.expenseCategoryId;

                await _otherExpenses.Insert(otherExpenses);
            }
        }