asp.net mvc - Mapping SubCategories to list Categories using valueInjecter mvc -
i want map sub categories model has foreign key category model categories model using "valueinjecter" mapping.
have made "viewmodel" , write list<category>
type property in , want bind sub categories it.
tables follows according specifications categories table:
id name 1 gender 2 role
sub categories table:
id categoryid name 1 1 male 2 1 femal 3 2 admin 4 2 user
you need this:
mapper.addmap<customer, customerinput>(src => { var res = new customerinput(); res.injectfrom(src); // maps simple properties same name , type res.coll = src.collection.select(srcitem => mapper.map<collitemrestype>(srcitem) return res; });
Comments
Post a Comment