Media object

The media object component can be used to build hierarchical style lists such as blog comments or tweets. In the following example application, we'll use it to return a search result view when the user searches for employees. Our model will have a 'ReportsTo' field indicating which employee other employees report to; the media object component would be ideal to indicate this visually.

The method located in SearchController that searches for the employees and returns the results to the view is as follows:

public IActionResult SearchEmployees(string query) { ViewBag.SearchQuery = query; var employees = GetEmployees(); if (!string.IsNullOrEmpty(query)) { var results = employees.Where(p => p.Name.Contains(query)); return View(results); ...

Get Bootstrap for ASP.NET MVC - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.