AnswerController

Let's go ahead with adding the AnswerController:

using System; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using TestMakerFreeWebApp.ViewModels; using System.Collections.Generic;  namespace TestMakerFreeWebApp.Controllers {     [Route("api/[controller]")]     public class AnswerController : Controller     {         // GET api/answer/all         [HttpGet("All/{questionId}")]         public IActionResult All(int questionId)         {             var sampleAnswers = new List<AnswerViewModel>();              // add a first sample answer             sampleAnswers.Add(new AnswerViewModel()             {                 Id = 1,                 QuestionId = questionId,                 Text = "Friends and family",                 CreatedDate = DateTime.Now,                 LastModifiedDate = DateTime.Now             });              // add a bunch of other sample answers  for (int i = 2; i <= 5; ...

Get ASP.NET Core 2 and Angular 5 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.