Created
July 22, 2018 09:39
-
-
Save ivanpaulovich/7bef3a9745f181757c8fbb1f009ac079 to your computer and use it in GitHub Desktop.
AccountsController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Route("api/[controller]")] | |
public class AccountsController : Controller | |
{ | |
private readonly IDepositUseCase _depositUseCase; | |
private readonly Presenter _presenter; | |
public AccountsController( | |
IDepositUseCase depositUseCase, | |
Presenter presenter) | |
{ | |
_depositUseCase = depositUseCase; | |
_presenter = presenter; | |
} | |
/// <summary> | |
/// Deposit to an account | |
/// </summary> | |
[HttpPatch("Deposit")] | |
public async Task<IActionResult> Deposit([FromBody]DepositRequest message) | |
{ | |
var output = await _depositUseCase.Execute(message.AccountId, message.Amount); | |
_presenter.Populate(output); | |
return _presenter.ViewModel; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment