Example #1
0
        public IActionResult CreateEmployeeElections(int id, [FromBody] BenefitElectionsForCreateDto elections)
        {
            if (elections == null)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (!_repo.EmployeeExists(id))
            {
                return(NotFound());
            }

            var dto = _repo.AddElections(id, elections);

            if (!_repo.Save())
            {
                _logger.LogError($"Error handling create employee benefit elections for Employee ID {id}");
                return(StatusCode(500, "Error while handling request for create Employee Benefit Elections"));
            }

            _logger.LogInformation($"Employee benefit elections for Employee with id {id} was added (POST).");

            return(CreatedAtRoute("GetEmployeeBenefitElections", new { id = dto.Employee.EmployeeId }, dto));
        }
Example #2
0
 public EmployeeBenefitElectionsDto AddElections(int id, BenefitElectionsForCreateDto elections)
 {
     throw new NotImplementedException();
 }