Exemplo n.º 1
0
        public Decimal GetEmployeeCost(Int32 id)
        {
            IPayrollRepository repo = GetRepository();
            Decimal            cost = 0;

            Employee employee = repo.GetEmployeeById(id);

            if (employee != null)
            {
                BenefitCalculator calc = new BenefitCalculator(employee.BenefitPlan, employee.PayCycle, new NameDiscount());
                cost = calc.CalculatePayPeriodCost(employee);
            }

            return(cost);
        }
        // PUT api/Employee
        public Boolean Update(Employee current)
        {
            IPayrollRepository repo = GetRepository();

            Employee original = repo.GetEmployeeById(current.Id);

            if (original != null)
            {
                current.BenefitPlanId = original.BenefitPlanId;
                current.MonthlyGross  = original.MonthlyGross;
                current.PayCycleId    = original.PayCycleId;

                return(repo.Update(current, original));
            }

            return(false);
        }