Controller: GetModelExampleController.cs
using Microsoft.AspNetCore.Mvc;
using SnapObjects.Data;
namespace Appeon.ApiDoc.IDataUnpackerExamples.Controllers
{
[Route("examples/IDataUnpacker/GetModel/[action]")]
public class GetModelExampleController : Controller
{
SchoolContext _dataContext;
public GetModelExampleController(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 GetModelExample(_dataContext);
example.Example(dataUnpacker);
return "SUCCESS";
}
}
}
Refer To
JSON File: GetModelExample