public async Task <ActionResult> Create([Bind(Include = "idBonusToSalary,carWashWorkersId,amount,date,note")] BonusToSalaryView bonusToSalaryView)
        {
            if (ModelState.IsValid)
            {
                BonusToSalaryBll bonusToSalaryBll = Mapper.Map <BonusToSalaryView, BonusToSalaryBll>(bonusToSalaryView);
                await _bonusToSalary.Insert(bonusToSalaryBll);

                return(RedirectToAction("Index"));
            }

            ViewBag.carWashWorkersId = new SelectList(Mapper.Map <IEnumerable <CarWashWorkersView> >(await _carWashWorkers.GetTable()), "id", "Name");
            return(View(bonusToSalaryView));
        }
Exemplo n.º 2
0
        public async Task PremiumAccrual(int carWashWorkers, double payroll)
        {
            BonusToSalaryBll bonusToSalaryResult = new BonusToSalaryBll();

            double bonusStart   = 1500;
            double bonusRresult = Math.Floor(payroll / bonusStart);

            if (bonusRresult > 0)
            {
                bonusToSalaryResult.amount           = bonusRresult * 50;
                bonusToSalaryResult.carWashWorkersId = carWashWorkers;
                bonusToSalaryResult.date             = DateTime.Now;
                bonusToSalaryResult.note             = $"Премия за кассу { payroll }";

                await _bonus.Insert(bonusToSalaryResult);
            }
        }
        private async Task <bool> InsertTableBonus(BonusToSalaryBll bonusToSalary)
        {
            await _bonus.Insert(bonusToSalary);

            return(true);
        }