private async Task CreateCategoryAsync(CategoryEditDto input)
        {
            var category = input.MapTo <Category>();

            category.TenantId = AbpSession.TenantId.Value;
            await _categoryRepository.InsertAsync(category);
        }
        private async Task UpdateCategoryAsync(CategoryEditDto input)
        {
            var tenantId = AbpSession.TenantId.Value;
            var category = await _categoryRepository.FirstOrDefaultAsync(c => c.Id == input.Id && c.TenantId == tenantId);

            input.MapTo(category);
        }
示例#3
0
        /// <summary>
        /// 编辑分类
        /// </summary>
        protected virtual async Task UpdateCategoryAsync(CategoryEditDto input)
        {
            var entity = await _categoryRepository.GetAsync(input.Id.Value);

            input.MapTo(entity);
            await _categoryRepository.UpdateAsync(entity);
        }
示例#4
0
        /// <summary>
        /// 新增分类
        /// </summary>
        protected virtual async Task <CategoryEditDto> CreateCategoryAsync(CategoryEditDto input)
        {
            var entity = input.MapTo <Category>();

            entity = await _categoryRepository.InsertAsync(entity);

            return(entity.MapTo <CategoryEditDto>());
        }
示例#5
0
        public virtual async Task UpdateCategoryAsync(CategoryEditDto input)
        {
            //TODO:更新前的逻辑判断,是否允许更新

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

            input.MapTo(entity);

            await _categoryRepository.UpdateAsync(entity);
        }
示例#6
0
        public virtual async Task <CategoryEditDto> CreateCategoryAsync(CategoryEditDto input)
        {
            //TODO:新增前的逻辑判断,是否允许新增

            var entity = input.MapTo <Category>();

            entity = await _categoryRepository.InsertAsync(entity);

            return(entity.MapTo <CategoryEditDto>());
        }
        protected virtual async Task Update(CategoryEditDto input)
        {
            //TODO:更新前的逻辑判断,是否允许更新

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

            input.MapTo(entity);

            // ObjectMapper.Map(input, entity);
            await _entityRepository.UpdateAsync(entity);
        }
示例#8
0
 public async Task CreateOrEditAsync(CategoryEditDto dto)
 {
     if (_AbpSession.TenantId != null)
     {
         dto.TenantId = (int)_AbpSession.TenantId;
     }
     else
     {
         dto.TenantId = 0;
     }
     throw new UserFriendlyException("ss");
     if (dto.Id > 0)
     {
         await _Repository.UpdateAsync(dto.MapTo <model.Category>());
     }
     else
     {
         await _Repository.InsertAsync(dto.MapTo <model.Category>());
     }
 }
        protected virtual async Task <CategoryEditDto> Create(CategoryEditDto input)
        {
            //TODO:新增前的逻辑判断,是否允许新增

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


            entity = await _entityRepository.InsertAsync(entity);

            return(entity.MapTo <CategoryEditDto>());
        }
 public async Task CreateOrEditAsync(CategoryEditDto dto)
 {
     try
     {
         if (dto.Id > 0)
         {
             await _Repository.UpdateAsync(dto.MapTo <GoodsCategory>());
         }
         else
         {
             if (_AbpSession.TenantId != null)
             {
                 dto.TenantId = (int)_AbpSession.TenantId;
             }
             await _Repository.InsertAsync(dto.MapTo <GoodsCategory>());
         }
     }
     catch (Exception e)
     {
         throw new UserFriendlyException(e.Message);
     }
 }
示例#11
0
        protected async Task UpdateCategoryAsync(CategoryEditDto input)
        {
            var model = await _categoryRepository.GetAsync(input.Id.Value);

            await _categoryRepository.UpdateAsync(input.MapTo(model));
        }
示例#12
0
 protected async Task CreateCategoryAsync(CategoryEditDto input)
 {
     await _categoryRepository.InsertAsync(input.MapTo <Category>());
 }