Esempio n. 1
0
        public ActionResult Calculate(BenefitsEmployeeModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("Calculate", model));
            }

            var benefitsEmployee = new BenefitEmployee(model.Employee.FirstName, model.Employee.LastName);

            if (model.Dependents != null && model.Dependents.Count > 0)
            {
                var dependents = new List <PaylocityBenefitsChallenge.Entities.Person>();
                foreach (var dependent in model.Dependents)
                {
                    var employeeDependent = new Person(dependent.FirstName, dependent.LastName);
                    dependents.Add(employeeDependent);
                }

                benefitsEmployee.Dependents = dependents;
            }

            var response = benefitsMgr.Value.GetEmployeeCost(benefitsEmployee);

            EmployeeCostModel responseModel = new EmployeeCostModel();

            responseModel.TotalBenefitCost         = response.TotalBenefitsCostPerYear;
            responseModel.EmployeeCostPerPayPeriod = response.TotalEmployeeCostPerPayPeriod;
            responseModel.EmployeeCostPerYear      = response.TotalEmployeeCostPerYear;

            return(View("ViewEmployeeCost", responseModel));
        }
Esempio n. 2
0
        public ActionResult Calculate()
        {
            var employee = new BenefitsEmployeeModel();

            return(View(employee));
        }