using BHServer.Data; using Microsoft.AspNetCore.Mvc; // For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 namespace BHServer.Controllers { [Route("[controller]")] [ApiController] public class APIController : ControllerBase { private readonly ApplicationDbContext _db; public APIController(ApplicationDbContext db) { _db = db; } // GET: / [HttpGet] public IEnumerable Get() { List arr = []; foreach (var entry in _db.Provinces.ToList()) { String str = @"{""id"": " + entry.ProvinceId + @", ""name"": """ + entry.Name + @""", ""faction"": " + entry.Faction + @", ""mul"": " + entry.Multiplier + @", ""ats"": " + entry.ATs + @", ""state"": " + entry.State + "}"; arr.Add(str); } return arr; } // GET //5 [HttpGet("{id}")] public string Get(int id) { return "value"; } // POST / [HttpPost] public void Post([FromBody] string value) { } // PUT //5 [HttpPut("{id}")] public void Put(int id, [FromBody] string value) { } // DELETE //5 [HttpDelete("{id}")] public void Delete(int id) { } } }