// GET: BonusPool public ActionResult Input() { var viewModel = new BonusCalculatorInput { AllEmployees = HrEmployee.GetEmployeeList() }; return(View(viewModel)); }
public ActionResult Calculate(BonusCalculatorInput model) { if (ModelState.IsValid) { int selectedEmployeeId = model.SelectedEmployeeId; int totalBonusPool = model.BonusPoolAmount; var selectedEmployee = HrEmployee.FindById(selectedEmployeeId); var bonusAllocation = HrEmployee.CalculateBonus(model.SelectedEmployeeId, model.BonusPoolAmount); var viewModel = new BonusCalculatorResult { hrEmployee = selectedEmployee, bonusPoolAllocation = bonusAllocation }; return(View("Result", viewModel)); } else { model.AllEmployees = HrEmployee.GetEmployeeList(); return(View("Input", model)); } }