Пример #1
0
        /// <summary>
        /// 详情
        /// </summary>
        /// <param name="employeeId">员工Id</param>
        /// <param name="emergencyContactId">主键</param>
        /// <returns></returns>
        public virtual async Task <EmergencyContactDetailDto> GetAsync(Guid employeeId, Guid emergencyContactId)
        {
            await _employeeRepository.GetAsync(employeeId);

            EmergencyContact entity = await _emergencyContactRepository
                                      .GetAsync(ec => ec.EmployeeId == employeeId && ec.Id == emergencyContactId);

            return(ObjectMapper.Map <EmergencyContact, EmergencyContactDetailDto>(entity));
        }
Пример #2
0
        /// <summary>
        /// 获取修改
        /// </summary>
        /// <param name="employeeId">员工Id</param>
        /// <param name="emergencyContactId">主键</param>
        /// <returns></returns>
        public virtual async Task <GetEmergencyContactForEditorOutput> GetEditorAsync(Guid employeeId, Guid emergencyContactId)
        {
            await _employeeRepository.GetAsync(employeeId);

            EmergencyContact entity = await _emergencyContactRepository
                                      .GetAsync(ec => ec.EmployeeId == employeeId && ec.Id == emergencyContactId);

            return(ObjectMapper.Map <EmergencyContact, GetEmergencyContactForEditorOutput>(entity));
        }
Пример #3
0
        public virtual async Task <EmergencyContactListDto> UpdateAsync(Guid employeeId, Guid emergencyContactId, EmergencyContactUpdateDto input)
        {
            await _employeeRepository.GetAsync(employeeId);

            EmergencyContact entity = await _emergencyContactRepository
                                      .GetAsync(ec => ec.EmployeeId == employeeId && ec.Id == emergencyContactId);

            entity = ObjectMapper.Map(input, entity);
            entity = await _emergencyContactRepository.UpdateAsync(entity);

            return(ObjectMapper.Map <EmergencyContact, EmergencyContactListDto>(entity));
        }