public async Task Update(SalaryExpensesBll elementToUpdate)
        {
            salaryExpenses salaryExpenses = Mapper.Map <SalaryExpensesBll, salaryExpenses>(elementToUpdate);

            _unitOfWork.salaryExpensesUnitOfWork.Update(salaryExpenses);
            await _unitOfWork.Save();
        }
        public async Task Insert(SalaryExpensesBll element)
        {
            salaryExpenses salaryExpenses = Mapper.Map <SalaryExpensesBll, salaryExpenses>(element);

            _unitOfWork.salaryExpensesUnitOfWork.Insert(salaryExpenses);
            await _unitOfWork.Save();
        }
        public async Task <ActionResult> Edit([Bind(Include = "idSalaryExpenses,idCarWashWorkers,amount,dateExpenses,expenseCategoryId")] SalaryExpensesView salaryExpensesView)
        {
            if (ModelState.IsValid)
            {
                SalaryExpensesBll salaryExpensesBll = Mapper.Map <SalaryExpensesView, SalaryExpensesBll>(salaryExpensesView);
                await _salaryExpenses.Insert(salaryExpensesBll);

                return(RedirectToAction("Index"));
            }

            ViewBag.Category = new SelectList(await _expenseCategory.GetTableAll(), "idExpenseCategory", "name");
            return(View(salaryExpensesView));
        }
        public async Task <ActionResult> Create([Bind(Include = "idSalaryExpenses,idCarWashWorkers,amount,dateExpenses,expenseCategoryId")] SalaryExpensesView salaryExpensesView)
        {
            if (ModelState.IsValid)
            {
                SalaryExpensesBll salaryExpensesBll = Mapper.Map <SalaryExpensesView, SalaryExpensesBll>(salaryExpensesView);
                await _salaryExpenses.Insert(salaryExpensesBll);

                return(RedirectToAction("Index"));
            }

            await DropDownListView();

            return(View(salaryExpensesView));
        }
        // ВНИМАНИЕЕ !!!!!!!!!
        // Изменить в соответствии с новой логикой Расходов
        private async Task PayrollExpenses(SalaryBalanceBll salaryBalance, int idPaymentState)
        {
            ExpensesBll expenses = new ExpensesBll();

            expenses.Amount            = salaryBalance.payoutAmount;
            expenses.dateExpenses      = salaryBalance.dateOfPayment;
            expenses.expenseCategoryId = 1;
            expenses.paymentType       = idPaymentState;
            // expenses.expenseCategoryId = 70;
            expenses.note = $"Выплачена через сервис ({salaryBalance.CarWashWorkersId})";

            int id = await _expenses.InsertId(expenses);

            SalaryExpensesBll salaryExpenses = new SalaryExpensesBll();

            salaryExpenses.idCarWashWorkers = salaryBalance.CarWashWorkersId;
            salaryExpenses.expenseId        = id;

            await _salaryExpenses.Insert(salaryExpenses);
        }
示例#6
0
 public salaryExpenses TransformAnEntity(SalaryExpensesBll entity) => Mapper.Map <SalaryExpensesBll, salaryExpenses>(entity);
示例#7
0
 public async Task Insert(SalaryExpensesBll element)
 {
     _unitOfWork.salaryExpensesUnitOfWork.Insert(TransformAnEntity(element));
     await _unitOfWork.Save();
 }
示例#8
0
 public async Task Update(SalaryExpensesBll elementToUpdate)
 {
     _unitOfWork.salaryExpensesUnitOfWork.Update(TransformAnEntity(elementToUpdate));
     await _unitOfWork.Save();
 }