|
1 | | -using System.Threading.Tasks; |
2 | 1 | using CapTest.Order.Service; |
3 | 2 | using Microsoft.AspNetCore.Mvc; |
4 | 3 |
|
5 | | -namespace CapTest.Order.Host.Controllers |
| 4 | +namespace CapTest.Order.Host.Controllers; |
| 5 | + |
| 6 | +[ApiController] |
| 7 | +[Route("[controller]")] |
| 8 | +public class OrderController : ControllerBase |
6 | 9 | { |
7 | | - [ApiController] |
8 | | - [Route("[controller]")] |
9 | | - public class OrderController : ControllerBase |
| 10 | + private readonly OrderService _orderService; |
| 11 | + |
| 12 | + public OrderController(OrderService orderService) |
| 13 | + { |
| 14 | + _orderService = orderService; |
| 15 | + } |
| 16 | + |
| 17 | + #region Methods |
| 18 | + |
| 19 | + [HttpPost] |
| 20 | + [Route("{id}")] |
| 21 | + public Task<string> CreateAsync(int id) |
10 | 22 | { |
11 | | - private readonly OrderService _orderService; |
12 | | - |
13 | | - public OrderController(OrderService orderService) |
14 | | - { |
15 | | - _orderService = orderService; |
16 | | - } |
17 | | - |
18 | | - [HttpPost] |
19 | | - [Route("{id}")] |
20 | | - public async Task<string> CreateAsync(int id) |
21 | | - { |
22 | | - return await _orderService.Create(id); |
23 | | - } |
24 | | - |
25 | | - [HttpPost] |
26 | | - [Route("CreateWithTransaction/{id}")] |
27 | | - public async Task<string> CreateWithTransactionAsync(int id) |
28 | | - { |
29 | | - return await _orderService.CreateWithoutCapPgsql(id); |
30 | | - } |
31 | | - |
32 | | - [HttpPost] |
33 | | - [Route("CreateMessageWithHeaders")] |
34 | | - // ReSharper disable once InconsistentNaming |
35 | | - public async Task<IActionResult> CreateTTLMessage() |
36 | | - { |
37 | | - await _orderService.CreateMessageWithHeaders(); |
38 | | - |
39 | | - return Ok(); |
40 | | - } |
| 23 | + return _orderService.Create(id); |
41 | 24 | } |
| 25 | + |
| 26 | + [HttpPost] |
| 27 | + [Route("CreateMessageWithHeaders")] |
| 28 | + // ReSharper disable once InconsistentNaming |
| 29 | + public async Task<IActionResult> CreateTTLMessage() |
| 30 | + { |
| 31 | + await _orderService.CreateMessageWithHeaders(); |
| 32 | + |
| 33 | + return Ok(); |
| 34 | + } |
| 35 | + |
| 36 | + [HttpPost] |
| 37 | + [Route("CreateWithTransaction/{id}")] |
| 38 | + public Task<string> CreateWithTransactionAsync(int id) |
| 39 | + { |
| 40 | + return _orderService.CreateWithoutCapPgsql(id); |
| 41 | + } |
| 42 | + |
| 43 | + #endregion |
| 44 | + |
42 | 45 | } |
0 commit comments