Controller: GetModelsExampleController.cs
using Microsoft.AspNetCore.Mvc;
using SnapObjects.Data;
namespace Appeon.ApiDoc.IDataUnpackerExamples.Controllers
{
[Route("examples/IDataUnpacker/GetModels/[action]")]
public class GetModelsExampleController : Controller
{
SchoolContext _dataContext;
public GetModelsExampleController(SchoolContext dataContext)
{
// Sets the data context.
_dataContext = dataContext;
}
[HttpPost]
public string Example(IDataUnpacker dataUnpacker)
{
// Uses IDataUnpack to receive JSON data from the client app.
var example = new GetModelsExample(_dataContext);
example.Example(dataUnpacker);
return "SUCCESS";
}
}
}
Refer To
JSON File: GetModelsExample