Exemplo n.º 1
0
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="employeeRequestDtos"></param>
        /// <returns></returns>
        public async Task <bool> BatchModifyAsync(IList <EmployeeRequestDto> employeeRequestDtos)
        {
            var ids       = employeeRequestDtos.Select(m => m.Id).ToList();
            var employees = await _employeeRespository.EntitiesByExpressionAsync(e => ids.Contains(e.Id));

            var entities = employeeRequestDtos.MapToModifyEntities <EmployeeRequestDto, Employee>(employees.ToList());
            await EmployeeValidatorsFilter.DoValidationAsync(_employeeRespository, entities, ValidatorTypeConstants.Create);

            await _employeeRespository.BatchUpdateAsync(entities);

            return(true);
        }