public async Task <ApplicationBaseResult> Execute(ChangeAmountInput input) { return(await DoAsync(async x => { var user = await _userRepository.GetAsync(input.Id); if (user == null) { throw new ApplicationException("用户不存在,请重试!"); } user.ChangeAmount(input.Plus, input.Amount); await _userRepository.SaveAsync(); })); }
public ActionResult ChangeAmount(ChangeAmountInput input) { if (!ModelState.IsValid) { return(View(input)); } try { s.ChangeAmount(input.Id, input.Amount, input.Amountm); } catch (AsmsEx e) { ModelState.AddModelError("amount", e.Message); return(View(input)); } return(Content("ok")); }