How to pass model to partial view

I had the same issue as the OP. From one of the comments, I realized that the second parameter shouldn’t be null, i.e from @model ParentViewModel @Html.Partial(“_Partial”, Model.Child) If Model.Child is null, then Model is passed instead of Model.Child. If there will be cases when the second parameter is null, then you will have to … Read more

Should a service layer return view models for an MVC application?

Generally, no. View models are intended to provide information to and from views and should be specific to the application, as opposed to the general domain. Controllers should orchestrate interaction with repositories, services (I am making some assumptions of the definition of service here), etc and handle building and validating view models, and also contain … Read more