Skip to content

Commit 5423172

Browse files
committed
fix routing issue
1 parent e1bc044 commit 5423172

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CheckDrive.Api/CheckDrive.Api/Controllers/AccountsController.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public async Task<ActionResult<List<AccountDto>>> GetAsync()
2323
return Ok(accounts);
2424
}
2525

26-
[HttpGet("{id}", Name = "GetByIdAsync")]
26+
[HttpGet("{id}", Name = nameof(GetAccountByIdAsync))]
2727
public async Task<ActionResult<AccountDto>> GetAccountByIdAsync(string id)
2828
{
2929
var account = await _service.GetByIdAsync(id);
@@ -36,7 +36,7 @@ public async Task<ActionResult<AccountDto>> CreateAsync([FromBody] CreateAccount
3636
{
3737
var createdAccount = await _service.CreateAsync(account);
3838

39-
return CreatedAtAction("GetByIdAsync", new { id = createdAccount.Id }, createdAccount);
39+
return CreatedAtAction(nameof(GetAccountByIdAsync), new { id = createdAccount.Id }, createdAccount);
4040
}
4141

4242
[HttpPut("{id}")]

CheckDrive.Api/CheckDrive.Api/Extensions/DependencyInjection.cs

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ private static void AddControllers(IServiceCollection services)
3737
services
3838
.AddControllers(options =>
3939
{
40+
options.SuppressAsyncSuffixInActionNames = false;
4041
options.ReturnHttpNotAcceptable = true;
4142
})
4243
.AddNewtonsoftJson(options =>

0 commit comments

Comments
 (0)