namespace Test150000.DB{ public class USERINFOTEST { [Key] public string USER_ID { get; set; } public DateTime TIMESTAMP { get; set; } public int STATUS { get; set; } public int PUNCH { get; set; } }}
namespace Test150000.DB{ public class DemoDBContext :DbContext { public DemoDBContext(DbContextOptions<DemoDBContext> options):base(options) { } public DbSet<USERINFOTEST> USERINFOTESTs { get; set; } }}
private DemoDBContext _dbContext; public DataController(DemoDBContext dbContext) { _dbContext = dbContext; } [HttpGet("GetData")] public IActionResult Get() { try { var datas = _dbContext.USERINFOTESTs.ToList(); if (datas.Count == 0) { return NotFound(); } return Ok(datas); } catch (Exception ex) { return StatusCode(500, ex.Message); }