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