Beispiel #1
0
        //5.3.2
        public async Task UpdateTest(TestEditDto input)
        {
            BD_Test test = input.MapTo <BD_Test>();

            await SetInstrumentTestsAsync(test.Id, input.InstrumentTestIds);

            await _testRepository.UpdateAsync(test);
        }
Beispiel #2
0
 //5.3.2 生成或者更新 test单据
 public async Task CreateOrUpdateTest(TestEditDto input)
 {
     if (input.Id.HasValue)
     {
         await UpdateTest(input);
     }
     else
     {
         await CreateTest(input);
     }
 }
Beispiel #3
0
        //5.3.1 生成test单据,指定user
        public async Task <long> CreateTest(TestEditDto input)
        {
            BD_Test test = input.MapTo <BD_Test>();

            long newTask_Id = await _testRepository.InsertAndGetIdAsync(test);

            await CurrentUnitOfWork.SaveChangesAsync();

            await SetInstrumentTestsAsync(test.Id, input.InstrumentTestIds);

            return(newTask_Id);
        }
Beispiel #4
0
        //5.3.1
        public TestEditDto GetTestForEdit(NullableIdDto <long> input)
        {
            //Standard   standard
            var testEditDto = new TestEditDto();

            if (input.Id.HasValue) //Editing existing role?
            {
                Debug.Assert(input.Id != null, "修改时ID不得为空.");
                var test = _testRepository.Get(input.Id.Value);
                testEditDto = test.MapTo <TestEditDto>();

                testEditDto.InstrumentTestIds = _instrumentTestRepository.GetAll()
                                                .Where(q => q.Test_ID == test.Id)
                                                .Select(q => q.Id).ToArray();
            }

            return(testEditDto);
        }