コード例 #1
0
        /// <summary>
        /// 编辑Locations
        /// </summary>
        //[AbpAuthorize(LocationsPermissions.Edit)]
        protected virtual async Task Update(LocationsEditDto input)
        {
            //TODO:更新前的逻辑判断,是否允许更新

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

            input.MapTo(entity);

            // ObjectMapper.Map(input, entity);
            await _entityRepository.UpdateAsync(entity);
        }
コード例 #2
0
        /// <summary>
        /// 新增Locations
        /// </summary>
        //[AbpAuthorize(LocationsPermissions.Create)]
        protected virtual async Task <LocationsEditDto> Create(LocationsEditDto input)
        {
            //TODO:新增前的逻辑判断,是否允许新增

            // var entity = ObjectMapper.Map <Locations>(input);
            var entity = input.MapTo <Locations>();


            entity = await _entityRepository.InsertAsync(entity);

            return(entity.MapTo <LocationsEditDto>());
        }
コード例 #3
0
        /// <summary>
        /// 获取编辑 Locations
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        //[AbpAuthorize(LocationsPermissions.Create,LocationsPermissions.Edit)]
        public async Task <GetLocationsForEditOutput> GetForEdit(NullableIdDto <long> input)
        {
            var output = new GetLocationsForEditOutput();
            LocationsEditDto editDto;

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

                editDto = entity.MapTo <LocationsEditDto>();

                //locationsEditDto = ObjectMapper.Map<List<locationsEditDto>>(entity);
            }
            else
            {
                editDto = new LocationsEditDto();
            }

            output.Locations = editDto;
            return(output);
        }