Esempio n. 1
0
        /// <summary>
        /// 编辑Document
        /// </summary>

        protected virtual async Task Update(DocumentEditDto input)
        {
            //TODO:更新前的逻辑判断,是否允许更新

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

            input.MapTo(entity);

            // ObjectMapper.Map(input, entity);
            await _entityRepository.UpdateAsync(entity);
        }
Esempio n. 2
0
        /// <summary>
        /// 新增Document
        /// </summary>

        protected virtual async Task <DocumentEditDto> Create(DocumentEditDto input)
        {
            //TODO:新增前的逻辑判断,是否允许新增

            // var entity = ObjectMapper.Map <Document>(input);
            var entity       = input.MapTo <Document>();
            var categoryList = await _docCategoryManager.GetHierarchyCategories(input.CategoryId);

            entity.CategoryCode = string.Join(',', categoryList.Select(c => c.Id).ToArray());
            entity.CategoryDesc = string.Join(',', categoryList.Select(c => c.Name).ToArray());
            entity = await _entityRepository.InsertAsync(entity);

            return(entity.MapTo <DocumentEditDto>());
        }