Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

View Model with Base class and Model binding is with post method is failed to populate base class properties.

$
0
0

In Asp.net core When i use base class for view model and when i use that in post method ,Model binder is unable to populate base class properties in model. 

public class AppDTO

{

public string Name{get;set;}

public string Email {get;set;}

}

public class AppViewModel:AppDTO

{

public string Address {get;set;}

}

And in Action method

public JsonResult PostApp(AppViewModel model)

{

// here when i try to access model values only address property is populated and name and email are null.

}

}

Any Recommentations ?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>