using BHServer.Data; using Microsoft.AspNetCore.Mvc; using BHServer.Models; using Newtonsoft.Json; // For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 namespace BHServer.Controllers { [Route("api/[controller]")] public class AssaultTroopController : ControllerBase { private readonly ApplicationDbContext _db; public AssaultTroopController(ApplicationDbContext db) { _db = db; } /*public IActionResult Index() { List ObjectAssaultTroopList = _db.AssaultTroops.ToList(); // If the above line faulters then ensure SQL Server is running return View(ObjectAssaultTroopList); }*/ // GET //5 [HttpGet] public string Get() { List assaultTroopList = _db.assault_troop.ToList(); return JsonConvert.SerializeObject(assaultTroopList); } // 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) { } } }