예제 #1
0
 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();
     }));
 }
예제 #2
0
 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"));
 }