예제 #1
0
        protected virtual async Task <MonthFeeEditDto> CreateMonthFeeAsync(MonthFeeEditDto input)
        {
            //TODO:新增前的逻辑判断,是否允许新增

            var entity = ObjectMapper.Map <MonthFee>(input);

            entity = await _monthfeeRepository.InsertAsync(entity);

            return(entity.MapTo <MonthFeeEditDto>());
        }
예제 #2
0
        protected virtual async Task UpdateMonthFeeAsync(MonthFeeEditDto input)
        {
            //TODO:更新前的逻辑判断,是否允许更新

            var entity = await _monthfeeRepository.GetAsync(input.Id.Value);

            input.MapTo(entity);

            // ObjectMapper.Map(input, entity);
            await _monthfeeRepository.UpdateAsync(entity);
        }
예제 #3
0
        /// <summary>
        /// MPA版本才会用到的方法
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <GetMonthFeeForEditOutput> GetMonthFeeForEdit(NullableIdDto <int> input)
        {
            var             output = new GetMonthFeeForEditOutput();
            MonthFeeEditDto monthfeeEditDto;

            if (input.Id.HasValue)
            {
                var entity = await _monthfeeRepository.GetAsync(input.Id.Value);

                monthfeeEditDto = entity.MapTo <MonthFeeEditDto>();

                //monthfeeEditDto = ObjectMapper.Map<List <monthfeeEditDto>>(entity);
            }
            else
            {
                monthfeeEditDto = new MonthFeeEditDto();
            }

            output.MonthFee = monthfeeEditDto;
            return(output);
        }