public async Task <ActionResult <VwEmpDetails> > Post(VwEmpDetails employeeDetailCreateRequest)
        {
            Employees employeeCreateRequest = new Employees {
                // EmpNo = -1,
                BirthDate = employeeDetailCreateRequest.BirthDate,
                FirstName = employeeDetailCreateRequest.FirstName,
                LastName  = employeeDetailCreateRequest.LastName,
                Gender    = employeeDetailCreateRequest.Gender,
                HireDate  = employeeDetailCreateRequest.HireDate
            };

            Employees employeeCreateResult = await _employeeRepository.PostAsync(employeeCreateRequest);

            int?empNo = employeeCreateResult?.EmpNo;

            if (empNo == null)
            {
                return(BadRequest());
            }

            VwDeptEmpCurrent deptEmpCreateRequest = new VwDeptEmpCurrent {
                EmpNo  = empNo.Value,
                DeptNo = employeeDetailCreateRequest.DeptNo
            };
            VwDeptEmpCurrent deptEmpCreateResult = await
                                                   _deptEmpRepository
                                                   .PostAsync(deptEmpCreateRequest);

            VwSalariesCurrent salaryCreateRequest = new VwSalariesCurrent {
                EmpNo  = empNo.Value,
                Salary = employeeDetailCreateRequest.Salary
            };
            VwSalariesCurrent salaryCreateResult = await
                                                   _salaryRepository
                                                   .PostAsync(salaryCreateRequest);

            VwTitlesCurrent titleCreateRequest = new VwTitlesCurrent {
                EmpNo = empNo.Value,
                Title = employeeDetailCreateRequest.Title
            };
            VwTitlesCurrent titleCreateResult = await
                                                _titleRepository
                                                .PostAsync(titleCreateRequest);

            VwEmpDetails result = await _employeeDetailRepository.GetAsync(empNo.Value.ToString());

            return(CreatedAtAction(
                       nameof(this.Post),
                       new { id = result.EmpNo },
                       result));
        }
        public async Task <ActionResult <VwEmpDetails> > Put(int id, VwEmpDetails employeeDetailUpdateRequest)
        {
            Employees employee = await _employeeRepository.GetAsync(id.ToString());

            VwSalariesCurrent salary = await _salaryRepository.GetAsync(id.ToString());

            VwTitlesCurrent title = await _titleRepository.GetAsync(id.ToString());

            VwDeptEmpCurrent deptEmp = await _deptEmpRepository.GetAsync(id.ToString());

            if (employee == null)
            {
                return(NotFound());
            }

            if (employeeBasicInfoChanged(employee, employeeDetailUpdateRequest))
            {
                Employees employeeUpdateRequest = new Employees {
                    EmpNo     = id,
                    BirthDate = employeeDetailUpdateRequest.BirthDate,
                    FirstName = employeeDetailUpdateRequest.FirstName,
                    LastName  = employeeDetailUpdateRequest.LastName,
                    Gender    = employeeDetailUpdateRequest.Gender,
                    HireDate  = employeeDetailUpdateRequest.HireDate
                };
                Employees employeeUpdateResult = await
                                                 _employeeRepository
                                                 .PutAsync(id.ToString(), employeeUpdateRequest);
            }

            if (deptEmp?.DeptNo != employeeDetailUpdateRequest.DeptNo)
            {
                VwDeptEmpCurrent deptEmpCreateRequest = new VwDeptEmpCurrent {
                    EmpNo  = employeeDetailUpdateRequest.EmpNo,
                    DeptNo = employeeDetailUpdateRequest.DeptNo
                };
                VwDeptEmpCurrent deptEmpCreateResult = await
                                                       _deptEmpRepository
                                                       .PostAsync(deptEmpCreateRequest);
            }

            if (salary?.Salary != employeeDetailUpdateRequest.Salary)
            {
                VwSalariesCurrent salaryCreateRequest = new VwSalariesCurrent {
                    EmpNo  = employeeDetailUpdateRequest.EmpNo,
                    Salary = employeeDetailUpdateRequest.Salary
                };
                VwSalariesCurrent salaryCreateResult = await
                                                       _salaryRepository
                                                       .PostAsync(salaryCreateRequest);
            }

            if (title?.Title != employeeDetailUpdateRequest.Title)
            {
                VwTitlesCurrent titleCreateRequest = new VwTitlesCurrent {
                    EmpNo = employeeDetailUpdateRequest.EmpNo,
                    Title = employeeDetailUpdateRequest.Title
                };
                VwTitlesCurrent titleCreateResult = await
                                                    _titleRepository
                                                    .PostAsync(titleCreateRequest);
            }

            VwEmpDetails result = await
                                  _employeeDetailRepository
                                  .GetAsync(id.ToString());

            return(result);
        }