-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#26 REST API - BankAccountController
- Loading branch information
1 parent
c69d193
commit 1212889
Showing
5 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
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
33 changes: 33 additions & 0 deletions
33
src/Optivem.Kata.Banking.Web/Controllers/BankAccountController.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using MediatR; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Optivem.Kata.Banking.Core.UseCases.OpenAccount; | ||
using Optivem.Kata.Banking.Core.UseCases.ViewAccount; | ||
|
||
namespace Optivem.Kata.Banking.Web.Controllers | ||
{ | ||
[ApiController] | ||
[Route("bank-accounts")] | ||
public class BankAccountController : ControllerBase | ||
{ | ||
private readonly IMediator _mediator; | ||
|
||
public BankAccountController(IMediator mediator) | ||
{ | ||
_mediator = mediator; | ||
} | ||
|
||
[HttpPost] | ||
public async Task<ActionResult<OpenAccountResponse>> OpenAccount(OpenAccountRequest request) | ||
{ | ||
// TODO: VC: Helpr base method which is async | ||
var response = await _mediator.Send(request); | ||
return CreatedAtAction(nameof(ViewAccount), new { accountNumber = response.AccountNumber }, response); | ||
} | ||
|
||
[HttpGet("{accountNumber}")] | ||
public async Task<ActionResult<ViewAccountResponse>> ViewAccount(string accountNumber) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
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
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
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