public async Task <ActionResult <Employee> > CreateEmployee(Employee employee) { employee.BiweeklySalary = 2000; employee.Cost = 1000; employee.DiscountFactor = DeductionHelpers.CalculateDiscountFactor(employee.FirstName); _context.Employees.Add(employee); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetEmployee), new { id = employee.EmployeeId }, employee)); }
public async Task <ActionResult <Dependent> > CreateEmployee(Dependent dependent) { dependent.Cost = 500; dependent.DiscountFactor = DeductionHelpers.CalculateDiscountFactor(dependent .FirstName); _context.Dependents.Add(dependent); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetDependent), new { id = dependent.DependentId }, dependent)); }