You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.3 KiB
49 lines
1.3 KiB
using Microsoft.AspNetCore.Mvc;
|
|
using Newtonsoft.Json;
|
|
using System.Data;
|
|
|
|
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
|
|
|
namespace DataTableAPIHost.Controllers
|
|
{
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class DataTableController : ControllerBase
|
|
{
|
|
// GET: api/<DataTableController>
|
|
[HttpGet]
|
|
public string Get()
|
|
{
|
|
return JsonConvert.SerializeObject(DataManager.Instance.DataTable);
|
|
}
|
|
|
|
// GET api/<DataTableController>/5
|
|
[HttpGet("{id}")]
|
|
public string Get(int id)
|
|
{
|
|
DataRow[] rows = DataManager.Instance.DataTable.Select($"ID = {id}");
|
|
return JsonConvert.SerializeObject(rows[0]);
|
|
}
|
|
|
|
//// POST api/<DataTableController>
|
|
//[HttpPost]
|
|
//public string Post([FromBody] string value)
|
|
//{
|
|
// return "";
|
|
//}
|
|
|
|
//// PUT api/<DataTableController>/5
|
|
//[HttpPut("{id}")]
|
|
//public string Put(int id, [FromBody] string value)
|
|
//{
|
|
// return "";
|
|
|
|
//}
|
|
|
|
//// DELETE api/<DataTableController>/5
|
|
//[HttpDelete("{id}")]
|
|
//public DataTable Delete(int id)
|
|
//{
|
|
//}
|
|
}
|
|
}
|
|
|