39 lines
901 B
C#
39 lines
901 B
C#
using adminsystem.Data;
|
|
using adminsystem.Entity;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace adminsystem.Web.Controllers
|
|
{
|
|
[Route("api/[controller]/[action]")]
|
|
[ApiController]
|
|
public class Test : ControllerBase
|
|
{
|
|
private PostgreDbContext _PostgreDbContext;
|
|
[HttpGet]
|
|
public string getstring()
|
|
{
|
|
return "helloworld";
|
|
}
|
|
|
|
public Test(PostgreDbContext postgreDbContext)
|
|
{
|
|
_PostgreDbContext = postgreDbContext;
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<ActionResult<IEnumerable<Geodata>>> GetData()
|
|
{
|
|
var geodata = await _PostgreDbContext.Geodatas.ToListAsync();
|
|
if (geodata == null)
|
|
{
|
|
return NotFound();
|
|
}
|
|
|
|
return geodata;
|
|
|
|
}
|
|
}
|
|
}
|