Click here to Skip to main content
14,879,988 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHotel ERP system Pin
Member 1492170724-Aug-20 4:36
MemberMember 1492170724-Aug-20 4:36 
AnswerRe: Hotel ERP system Pin
Richard Deeming24-Aug-20 4:52
mveRichard Deeming24-Aug-20 4:52 
AnswerRe: Hotel ERP system Pin
Mycroft Holmes24-Aug-20 12:22
professionalMycroft Holmes24-Aug-20 12:22 
GeneralRe: Hotel ERP system Pin
CHill604-Sep-20 0:37
mveCHill604-Sep-20 0:37 
AnswerRe: Hotel ERP system Pin
Eddy Vluggen24-Aug-20 12:39
professionalEddy Vluggen24-Aug-20 12:39 
Question.Net Core 3.2 Controller, using route and HttpGet attribute with CreatedAtRoute Pin
jkirkerx19-Aug-20 8:39
professionaljkirkerx19-Aug-20 8:39 
AnswerRe: .Net Core 3.2 Controller, using route and HttpGet attribute with CreatedAtRoute Pin
jkirkerx19-Aug-20 10:04
professionaljkirkerx19-Aug-20 10:04 
AnswerRe: .Net Core 3.2 Controller, using route and HttpGet attribute with CreatedAtRoute Pin
Richard Deeming19-Aug-20 21:58
mveRichard Deeming19-Aug-20 21:58 
jkirkerx wrote:
CreatedAtRoute("GetOrder", new { order.Id }, order)
...
HttpGet("GetAdminOrder/{orderId}")
IIRC, the parameters passed to CreatedAtRoute need to have the same names as the route parameters.

Your route has orderId, but you parameters has just Id.

Try changing the parameters to match.

You don't need to add both HttpGet and Route attributes.

You should also return the CreatedAtRoute result directly, rather than wrapping it in an Ok result.
return CreatedAtRoute("GetOrder", new { orderId = order.Id }, order);
[HttpGet("GetAdminOrder/{orderId}", Name = "GetOrder"), Authorize(AuthenticationSchemes = AuthSchemes, Policy = AuthPolicies.Admin)]
public async Task<Order> GetAdminOrder(string orderId)




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: .Net Core 3.2 Controller, using route and HttpGet attribute with CreatedAtRoute Pin
jkirkerx20-Aug-20 4:33
professionaljkirkerx20-Aug-20 4:33 
GeneralRe: .Net Core 3.2 Controller, using route and HttpGet attribute with CreatedAtRoute Pin
jkirkerx21-Aug-20 9:43
professionaljkirkerx21-Aug-20 9:43 
Questionsubmit button Pin
Member 1491014318-Aug-20 23:40
MemberMember 1491014318-Aug-20 23:40 
SuggestionRe: submit button Pin
Richard MacCutchan19-Aug-20 0:16
mveRichard MacCutchan19-Aug-20 0:16 
GeneralRe: submit button Pin
Member 1491014319-Aug-20 0:34
MemberMember 1491014319-Aug-20 0:34 
GeneralRe: submit button Pin
Richard MacCutchan19-Aug-20 0:41
mveRichard MacCutchan19-Aug-20 0:41 
GeneralRe: submit button Pin
Member 1491014319-Aug-20 1:05
MemberMember 1491014319-Aug-20 1:05 
AnswerRe: submit button Pin
F-ES Sitecore19-Aug-20 0:37
mveF-ES Sitecore19-Aug-20 0:37 
GeneralRe: submit button Pin
Member 1491014319-Aug-20 0:46
MemberMember 1491014319-Aug-20 0:46 
GeneralRe: submit button Pin
F-ES Sitecore19-Aug-20 1:46
mveF-ES Sitecore19-Aug-20 1:46 
AnswerRe: submit button Pin
Otekpo Emmanuel19-Aug-20 7:56
MemberOtekpo Emmanuel19-Aug-20 7:56 
QuestionRe: submit button Pin
ZurdoDev28-Aug-20 4:51
professionalZurdoDev28-Aug-20 4:51 
QuestionWhy ASP.NET MVC\Core ??? Pin
Steve Naidamast16-Aug-20 6:38
professionalSteve Naidamast16-Aug-20 6:38 
AnswerRe: Why ASP.NET MVC\Core ??? Pin
Mycroft Holmes16-Aug-20 12:53
professionalMycroft Holmes16-Aug-20 12:53 
GeneralRe: Why ASP.NET MVC\Core ??? Pin
Steve Naidamast18-Aug-20 6:51
professionalSteve Naidamast18-Aug-20 6:51 
GeneralRe: Why ASP.NET MVC\Core ??? Pin
Mycroft Holmes18-Aug-20 12:11
professionalMycroft Holmes18-Aug-20 12:11 
GeneralRe: Why ASP.NET MVC\Core ??? Pin
Steve Naidamast18-Aug-20 12:28
professionalSteve Naidamast18-Aug-20 12:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.