public virtual async Task UpdateImgCategoryAsync(ImgCategoryEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _imgCategoryRepository.GetAsync(input.Id.Value); input.MapTo(entity); await _imgCategoryRepository.UpdateAsync(entity); }
public virtual async Task <ImgCategoryEditDto> CreateImgCategoryAsync(ImgCategoryEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = input.MapTo <ImgCategory>(); entity = await _imgCategoryRepository.InsertAsync(entity); return(entity.MapTo <ImgCategoryEditDto>()); }
/// <summary> /// 通过Id获取图片分类信息进行编辑或修改 /// </summary> public async Task <GetImgCategoryForEditOutput> GetImgCategoryForEditAsync(NullableIdDto <int> input) { var output = new GetImgCategoryForEditOutput(); ImgCategoryEditDto imgCategoryEditDto; if (input.Id.HasValue) { var entity = await _imgCategoryRepository.GetAsync(input.Id.Value); imgCategoryEditDto = entity.MapTo <ImgCategoryEditDto>(); } else { imgCategoryEditDto = new ImgCategoryEditDto(); } output.ImgCategory = imgCategoryEditDto; return(output); }