/// <summary> /// 更新交易分类 /// </summary> /// <param name="id"></param> /// <param name="input"></param> /// <returns></returns> /// <exception cref="UserFriendlyException"></exception> public async Task <TradeCategoryDto> UpdateAsync(Guid id, UpdateTradeCategoryInput input) { var isExist = await _tradeCategoryRepo.AnyAsync(i => i.Name == input.Name); if (isExist) { throw new UserFriendlyException($"'{input.Name}' 已被注册"); } var tradeCategory = await _tradeCategoryRepo.GetAsync(r => r.Id == id); ObjectMapper.Map(input, tradeCategory); await _tradeCategoryRepo.UpdateAsync(tradeCategory, true); return(ObjectMapper.Map <TradeCategory, TradeCategoryDto>(tradeCategory)); }
public virtual Task <TradeCategoryDto> UpdateAsync(Guid id, UpdateTradeCategoryInput input) { return(_service.UpdateAsync(id, input)); }