Now that we know how to use Mapster, we can upgrade our QuizController accordingly. Open the QuizController.cs file and perform the following changes (new/updated lines are highlighted):
using System;using Microsoft.AspNetCore.Mvc;using Newtonsoft.Json;using TestMakerFreeWebApp.ViewModels;using System.Collections.Generic;using System.Linq;using TestMakerFreeWebApp.Data;using Mapster;namespace TestMakerFreeWebApp.Controllers{ [Route("api/[controller]")] public class QuizController : Controller { #region Private Fields private ApplicationDbContext DbContext; #endregion #region Constructor public QuizController(ApplicationDbContext context) { // Instantiate the ApplicationDbContext through DI DbContext = context; ...