예제 #1
0
        public async Task <IActionResult> Create(Grade grade)
        {
            grade.CreatedBy = _userManager.GetUserName(User);

            var createGrade = await _grade.AddAsync(grade);

            if (createGrade)
            {
                Alert("Grade created successfully.", NotificationType.success);
                return(RedirectToAction("Index"));
            }
            else
            {
                Alert("Grade not created!", NotificationType.error);
            }


            return(View());
        }
예제 #2
0
        public async Task <IActionResult> Create(Grade g)
        {
            //FOR HOUSING
            g.Housing     = g.HousingPercent * g.BasicSalary / 100;
            g.GrossSalary = g.BasicSalary;

            if (g.HousingItemType == "Allowance")
            {
                g.GrossSalary += g.Housing;
            }
            else if (g.HousingItemType == "Deduction")
            {
                g.GrossSalary -= g.Housing;
            }

            //FOR LUNCH
            g.Lunch = g.LunchPercent * g.BasicSalary / 100;

            if (g.LunchItemType == "Allowance")
            {
                g.GrossSalary += g.Lunch;
            }

            else if (g.LunchItemType == "Deduction")
            {
                g.GrossSalary -= g.Lunch;
            }

            //FOR TRANSPORT
            g.Transport = g.TransportPercent * g.BasicSalary / 100;

            if (g.TransportItemType == "Allowance")
            {
                g.GrossSalary += g.Transport;
            }
            else if (g.TransportItemType == "Deduction")
            {
                g.GrossSalary -= g.Transport;
            }

            //FOR MEDICAL
            g.Medical = g.MedicalPercent * g.BasicSalary / 100;

            if (g.MedicalItemType == "Allowance")
            {
                g.GrossSalary += g.Medical;
            }
            else if (g.MedicalItemType == "Deduction")
            {
                g.GrossSalary -= g.Medical;
            }

            //TOTAL g
            g.Tax = g.TaxPercent * g.GrossSalary / 100;

            g.NetSalary = g.GrossSalary - g.Tax;



            var createGrade = await _grade.AddAsync(g);

            if (createGrade)
            {
                Alert("Grade created successfully.", NotificationType.success);
                return(RedirectToAction("Index"));
            }
            else
            {
                Alert("Grade not created!", NotificationType.error);
            }
            return(View());
        }