/// <summary> /// 创建交易分类 /// </summary> /// <param name="input"></param> /// <returns></returns> /// <exception cref="UserFriendlyException"></exception> public async Task <TradeCategoryDto> CreateAsync(CreateTradeCategoryInput input) { var isExist = await _tradeCategoryRepo.AnyAsync(i => i.Name == input.Name); if (isExist) { throw new UserFriendlyException($"'{input.Name}' 已被注册"); } var tradeCategory = ObjectMapper.Map <CreateTradeCategoryInput, TradeCategory>(input); await _tradeCategoryRepo.InsertAsync(tradeCategory, true); return(ObjectMapper.Map <TradeCategory, TradeCategoryDto>(tradeCategory)); }
public virtual Task <TradeCategoryDto> CreateAsync(CreateTradeCategoryInput input) { return(_service.CreateAsync(input)); }