/// <summary> /// Refills the amount from the bank account by using <paramref name="bankAccountService"/>. /// </summary> /// <param name="operationData">A data of the operation with the bank account.</param> /// <param name="bankAccountService">A service to make the refill.</param> public void Execute(OperationDataViewModel operationData, IBankAccountService bankAccountService) { try { bankAccountService.Refill(operationData.AccountIdTo, operationData.Amount); } catch (BankServiceException exception) { throw exception; } }
public ActionResult Operation(OperationDataViewModel operationData) { try { CommandProvider commandProvider = new CommandProvider(); commandProvider.GetCommand(operationData.Operation).Execute(operationData, _bankAccountService); return(RedirectToAction("Index")); } catch (BankServiceException exception) { ViewBag.ErrorMessage = exception.Message; return(View("Error")); } }