asp net core: [FromRoute] and model bindingHow to enable assembly bind failure logging (Fusion) in .NETJavaScriptSerializer - JSON serialization of enum as stringAsp net core rc2. Abstract class model bindingAsp.Net Core Model binding, how to get empty field to bind as a blank string?Url.Link always returns null used within asp..net web apiSet model binding form field name at runtime in ASP .NET CoreWhere can you find model binding errors in ASP.NET Core MVC?ASP Net Core Attribute routing and double forward slashAsp.net core not binding post model if invalid property values are presentRoute to controller based on query string
Why might one *not* want to use a capo?
Is there a way to tell what frequency I need a PWM to be?
Which polygons can be turned inside out by a smooth deformation?
How to say "I only speak one language which is English" in French?
If the UK Gov. has authority to cancel article 50 notification, why do they have to agree an extension with the EU
Is the internet in Madagascar faster than in UK?
Did ancient peoples ever hide their treasure behind puzzles?
How could a self contained organic body propel itself in space
How does attacking during a conversation affect initiative?
Coupling two 15 Amp circuit breaker for 20 Amp
Can subqueries produce different execution plans than CTE's?
Stolen MacBook should I worry about my data?
Find feasible point in polynomial time in linear programming
Why did the population of Bhutan drop by 70% between 2007 and 2008?
Can I get a PhD for developing educational software?
Should I use the words "pyromancy" and "necromancy" even if they don't mean what people think they do?
How did medieval manors handle population growth? Were there room for more fields to be ploughed?
What's the point of fighting monsters in Zelda BotW?
Why does glibc's strlen need to be so complicated to run quickly?
Is there an in-universe explanation given to the senior Imperial Navy Officers as to why Darth Vader serves Emperor Palpatine?
Group riding etiquette
Heat output from a 200W electric radiator?
If I said I had $100 when asked, but I actually had $200, would I be lying by omission?
Employing a contractor proving difficult
asp net core: [FromRoute] and model binding
How to enable assembly bind failure logging (Fusion) in .NETJavaScriptSerializer - JSON serialization of enum as stringAsp net core rc2. Abstract class model bindingAsp.Net Core Model binding, how to get empty field to bind as a blank string?Url.Link always returns null used within asp..net web apiSet model binding form field name at runtime in ASP .NET CoreWhere can you find model binding errors in ASP.NET Core MVC?ASP Net Core Attribute routing and double forward slashAsp.net core not binding post model if invalid property values are presentRoute to controller based on query string
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
is it possible to bind a parameter from the url to a property of the DTO that is being Model Binded?
[Route("delivery/document")]
[HttpPost]
public IActionResult Delivery(DeliveryIn data)
//...
This code with the following DTO always gives me document as null:
public class DeliveryIn
[FromRoute]
public string document get; set;
[Required]
public decimal amount get; set;
Is it impossible to bind this property as I am trying? do I have to add it as an argument to the action?
c# asp.net-core
|
show 1 more comment
is it possible to bind a parameter from the url to a property of the DTO that is being Model Binded?
[Route("delivery/document")]
[HttpPost]
public IActionResult Delivery(DeliveryIn data)
//...
This code with the following DTO always gives me document as null:
public class DeliveryIn
[FromRoute]
public string document get; set;
[Required]
public decimal amount get; set;
Is it impossible to bind this property as I am trying? do I have to add it as an argument to the action?
c# asp.net-core
1
How do you send the request?
– Sirwan Afifi
Mar 27 at 21:53
1
Your example works totally fine
– Alexander
Mar 27 at 22:26
What do you mean bybind a parameter from the body to a property of the DTO
? Based on your description, it seems you want to binddocument
fromroute
, what do you mean by body? Do you want to binddocument
from route or body?
– Tao Zhou
Mar 28 at 2:31
@TaoZhou I meant binding a parameter from the route, sorry. I edited the original question
– Lucas Lobosque
Mar 28 at 9:45
1
Did you try to run it and got some error or unexpected behavior? Because, as @Alexander said, your example should work just fine.
– Marko Papic
Mar 28 at 10:57
|
show 1 more comment
is it possible to bind a parameter from the url to a property of the DTO that is being Model Binded?
[Route("delivery/document")]
[HttpPost]
public IActionResult Delivery(DeliveryIn data)
//...
This code with the following DTO always gives me document as null:
public class DeliveryIn
[FromRoute]
public string document get; set;
[Required]
public decimal amount get; set;
Is it impossible to bind this property as I am trying? do I have to add it as an argument to the action?
c# asp.net-core
is it possible to bind a parameter from the url to a property of the DTO that is being Model Binded?
[Route("delivery/document")]
[HttpPost]
public IActionResult Delivery(DeliveryIn data)
//...
This code with the following DTO always gives me document as null:
public class DeliveryIn
[FromRoute]
public string document get; set;
[Required]
public decimal amount get; set;
Is it impossible to bind this property as I am trying? do I have to add it as an argument to the action?
c# asp.net-core
c# asp.net-core
edited Mar 28 at 9:44
Lucas Lobosque
asked Mar 27 at 21:25
Lucas LobosqueLucas Lobosque
1343 silver badges14 bronze badges
1343 silver badges14 bronze badges
1
How do you send the request?
– Sirwan Afifi
Mar 27 at 21:53
1
Your example works totally fine
– Alexander
Mar 27 at 22:26
What do you mean bybind a parameter from the body to a property of the DTO
? Based on your description, it seems you want to binddocument
fromroute
, what do you mean by body? Do you want to binddocument
from route or body?
– Tao Zhou
Mar 28 at 2:31
@TaoZhou I meant binding a parameter from the route, sorry. I edited the original question
– Lucas Lobosque
Mar 28 at 9:45
1
Did you try to run it and got some error or unexpected behavior? Because, as @Alexander said, your example should work just fine.
– Marko Papic
Mar 28 at 10:57
|
show 1 more comment
1
How do you send the request?
– Sirwan Afifi
Mar 27 at 21:53
1
Your example works totally fine
– Alexander
Mar 27 at 22:26
What do you mean bybind a parameter from the body to a property of the DTO
? Based on your description, it seems you want to binddocument
fromroute
, what do you mean by body? Do you want to binddocument
from route or body?
– Tao Zhou
Mar 28 at 2:31
@TaoZhou I meant binding a parameter from the route, sorry. I edited the original question
– Lucas Lobosque
Mar 28 at 9:45
1
Did you try to run it and got some error or unexpected behavior? Because, as @Alexander said, your example should work just fine.
– Marko Papic
Mar 28 at 10:57
1
1
How do you send the request?
– Sirwan Afifi
Mar 27 at 21:53
How do you send the request?
– Sirwan Afifi
Mar 27 at 21:53
1
1
Your example works totally fine
– Alexander
Mar 27 at 22:26
Your example works totally fine
– Alexander
Mar 27 at 22:26
What do you mean by
bind a parameter from the body to a property of the DTO
? Based on your description, it seems you want to bind document
from route
, what do you mean by body? Do you want to bind document
from route or body?– Tao Zhou
Mar 28 at 2:31
What do you mean by
bind a parameter from the body to a property of the DTO
? Based on your description, it seems you want to bind document
from route
, what do you mean by body? Do you want to bind document
from route or body?– Tao Zhou
Mar 28 at 2:31
@TaoZhou I meant binding a parameter from the route, sorry. I edited the original question
– Lucas Lobosque
Mar 28 at 9:45
@TaoZhou I meant binding a parameter from the route, sorry. I edited the original question
– Lucas Lobosque
Mar 28 at 9:45
1
1
Did you try to run it and got some error or unexpected behavior? Because, as @Alexander said, your example should work just fine.
– Marko Papic
Mar 28 at 10:57
Did you try to run it and got some error or unexpected behavior? Because, as @Alexander said, your example should work just fine.
– Marko Papic
Mar 28 at 10:57
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55386680%2fasp-net-core-fromroute-and-model-binding%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55386680%2fasp-net-core-fromroute-and-model-binding%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
How do you send the request?
– Sirwan Afifi
Mar 27 at 21:53
1
Your example works totally fine
– Alexander
Mar 27 at 22:26
What do you mean by
bind a parameter from the body to a property of the DTO
? Based on your description, it seems you want to binddocument
fromroute
, what do you mean by body? Do you want to binddocument
from route or body?– Tao Zhou
Mar 28 at 2:31
@TaoZhou I meant binding a parameter from the route, sorry. I edited the original question
– Lucas Lobosque
Mar 28 at 9:45
1
Did you try to run it and got some error or unexpected behavior? Because, as @Alexander said, your example should work just fine.
– Marko Papic
Mar 28 at 10:57