A question about CreatedAtAction() method
ASP.NET
2
Posts
2
Posters
20
Views
1
Watching
-
Hi, What does
CreatedAtAction(...)
method do in the following code (a part of an API code)?
//Add single card
[HttpPost]
[Route("id:guid")]
public async Task AddCard([FromBody] Card card)
{
card.Id = Guid.NewGuid();
await context.AddAsync(card);
await context.SaveChangesAsync();
return CreatedAtAction(nameof(GetCard), card.Id, card);
} -
Hi, What does
CreatedAtAction(...)
method do in the following code (a part of an API code)?
//Add single card
[HttpPost]
[Route("id:guid")]
public async Task AddCard([FromBody] Card card)
{
card.Id = Guid.NewGuid();
await context.AddAsync(card);
await context.SaveChangesAsync();
return CreatedAtAction(nameof(GetCard), card.Id, card);
}