Beispiel #1
0
        /// <summary>
        /// 更新数据
        /// </summary>
        public async Task <TagReleationDto> Update(TagReleationInputDto input)
        {
            try
            {
                var entity = _ITagReleationRepository.Get(input.Id);
                if (entity != null)
                {
                    entity.MapID     = input.MapID;
                    entity.DataTagID = input.DataTagID;
                }
                var dto = await _ITagReleationRepository.UpdateAsync(entity);

                var result = dto.MapTo <TagReleationDto>();
                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 新增数据
        /// </summary>
        public async Task <TagReleationDto> Insert(TagReleationInputDto input)
        {
            try
            {
                input.Id = Guid.NewGuid().ToString();
                TagReleationEntity entity = new TagReleationEntity
                {
                    Id        = input.Id,
                    DataTagID = input.DataTagID,
                    MapID     = input.MapID
                };
                var query = await _ITagReleationRepository.InsertAsync(entity);

                var result = entity.MapTo <TagReleationDto>();
                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }