Controller: TrackRangeExampleController.cs
using SnapObjects.Data;
using Appeon.ApiDoc.Models.School;
using Microsoft.AspNetCore.Mvc;
namespace Appeon.ApiDoc.ISqlModelMapperExamples
{
[Route("examples/ISqlModelMapper/TrackRange/[action]")]
public class TrackRangeExampleController : Controller
{
SchoolContext _dataContext;
public TrackRangeExampleController(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 newStudents = dataUnpacker.GetModelEntries<Person>("students");
var example = new TrackRangeExample(_dataContext);
example.Example(newStudents);
return "SUCCESS";
}
}
}
Refer To
JSON File: TrackRangeExample