I got Deal and a DealType classes in my asp.net web api project. In my ember project I got "deal" and "dealtype" (code at end of question)
While all works fine retrieving data, (can read say deal.dealtype.id ), upon submitting a deal back to the api, the Deal's DealType is always null.
I first assumed it's ember, but it does the same if I manually set the deal's type in my component (also checking the model's deal type there...it's set and all good)
So I assume it got something to do with model binding in my web api? (btw, I'm using ember-web-api adapter)
Ember "deal" and "dealtype" Models
export default Model.extend({
name: attr('string'),
uniqueId: attr('string'),
longName: attr('string'),
dealType: belongsTo('dealtype'),
//getting desperate...
dealTypeId: attr('number')
});
export default Model.extend({
name: attr('string')
})
C# models in api look exactly the same, except for the casing of course.
Api controller action
[Route("api/deals")]
[HttpPost]
public HttpResponseMessage Post(DealDto deal)
{....
All properties (like name, etc) post through fine, it's just the child property "dealtype" that's not.
What confuse me more is the exact same models work 100% when retrieving data.....hmmmm , that must be a modelbinding issue no?
Aucun commentaire:
Enregistrer un commentaire