liveBook · Manning

View model

A view model is a data structure that supplies a user-interface view with the data required to render a particular output.

How 3 Manning books explain it

.NET MAUI in Action

A view model is a data transfer object that aggregates the data required to render a particular view, without providing application functionality.

How it is used
Aggregates all data needed to render a web view into one API response.
How deep it goes
Defines the DTO role and contrasts it with an MVVM ViewModel, without detailing API implementation.
Examples
Uses a sales leaderboard containing salesperson, monthly-total, and monthly-average data.
What you can do after
Evaluate/understand whether a view-specific aggregate DTO can replace multiple web-view API calls.

Read how .NET MAUI in Action explains view model →

Pro ASP.NET Core 7, Tenth Edition

A view model is the data supplied to a view for incorporation into its rendered output.

How it is used
Supplies controller-selected data to Razor views so actions can produce dynamic HTML responses.
How deep it goes
Works from a string through objects, collections, and composite classes, including typed access and nullable model handling.
Examples
Uses a time-dependent greeting, RSVP form and response, paged product catalog, and login form.
What you can do after
Build it from scratch by passing typed data from an MVC action and rendering its properties or collections in a Razor view.

Read how Pro ASP.NET Core 7, Tenth Edition explains view model →

ASP.NET Core in Action, 3e

A view model is an object or data structure containing the information a user-interface view requires to render a response.

How it is used
Supplies Razor views with UI-ready data after a handler or controller obtains application data.
How deep it goes
Defines rendering data and works through PageModel properties, ViewResult delivery, and an EF Core projection.
Examples
Uses an error page’s request ID and a projected list of recipe summaries.
What you can do after
Apply it via MVC’s View(model) or Razor Pages’ PageModel properties to provide rendering data to a Razor view.

Read how ASP.NET Core in Action, 3e explains view model →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.