/// <summary>
        /// this method is used to edit the employees's educational details
        /// </summary>
        /// <param name="employeeEducationalDetails">Employee Educational Details</param>
        public async Task EditEmployeeEducationalDetailsAsync(EditEmployeeEducationalInformationDto employeeEducationalDetails)
        {
            var oldEmployeeData = await _employeeRepository.GetEmployeeInformationAsync(employeeEducationalDetails.Id);

            if (oldEmployeeData == null)
            {
                throw new Exception("Employee does not exist in the system");
            }

            _mapper.Map(employeeEducationalDetails, oldEmployeeData);
            oldEmployeeData.ModifiedAt = DateTime.UtcNow;
            await _employeeRepository.SaveChangesAsync();
        }
        /// <summary>
        /// this method is used to get all the educational details of employee
        /// </summary>
        /// <param name="employeeId">used to identify the required employee</param>
        public async Task <EditEmployeeEducationalInformationDto> GetEmployeeEducationalDetails(Guid employeeId)
        {
            var employeeDetails = await _employeeRepository.GetEmployeeInformationAsync(employeeId);

            if (employeeDetails == null)
            {
                throw new Exception("Employee does not exist in the system");
            }
            EditEmployeeEducationalInformationDto employeeEducationalDetails = new EditEmployeeEducationalInformationDto();

            _mapper.Map(employeeDetails, employeeEducationalDetails);

            return(employeeEducationalDetails);
        }
Пример #3
0
        public async Task <ActionResult> EditEmployeeEducationalDetailsAsync([FromBody] EditEmployeeEducationalInformationDto employeeEducationalDetails)
        {
            await _employeeService.EditEmployeeEducationalDetailsAsync(employeeEducationalDetails);

            return(Ok());
        }