/// <summary> /// 新增CarTypes /// </summary> //[AbpAuthorize(CarTypesAppPermissions.CarTypes_Create)] protected virtual async Task <CarTypesEditDto> CreateCarTypesAsync(CarTypesEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = ObjectMapper.Map <CarTypes>(input); entity = await _cartypesRepository.InsertAsync(entity); return(entity.MapTo <CarTypesEditDto>()); }
/// <summary> /// 编辑CarTypes /// </summary> //[AbpAuthorize(CarTypesAppPermissions.CarTypes_Edit)] protected virtual async Task UpdateCarTypesAsync(CarTypesEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _cartypesRepository.GetAsync(input.Id.Value); input.MapTo(entity); // ObjectMapper.Map(input, entity); await _cartypesRepository.UpdateAsync(entity); }
/// <summary> /// MPA版本才会用到的方法 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <GetCarTypesForEditOutput> GetCarTypesForEdit(NullableIdDto <long> input) { var output = new GetCarTypesForEditOutput(); CarTypesEditDto cartypesEditDto; if (input.Id.HasValue) { var entity = await _cartypesRepository.GetAsync(input.Id.Value); cartypesEditDto = entity.MapTo <CarTypesEditDto>(); //cartypesEditDto = ObjectMapper.Map<List <cartypesEditDto>>(entity); } else { cartypesEditDto = new CarTypesEditDto(); } output.CarTypes = cartypesEditDto; return(output); }