52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
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<AssaultTroop> ObjectAssaultTroopList = _db.AssaultTroops.ToList();
|
|
// If the above line faulters then ensure SQL Server is running
|
|
return View(ObjectAssaultTroopList);
|
|
}*/
|
|
|
|
// GET /<APIController>/5
|
|
[HttpGet]
|
|
public string Get()
|
|
{
|
|
List<AssaultTroop> assaultTroopList = _db.assault_troop.ToList();
|
|
return JsonConvert.SerializeObject(assaultTroopList);
|
|
}
|
|
|
|
// POST /<APIController>
|
|
[HttpPost]
|
|
public void Post([FromBody] string value)
|
|
{
|
|
}
|
|
|
|
// PUT /<APIController>/5
|
|
[HttpPut("{id}")]
|
|
public void Put(int id, [FromBody] string value)
|
|
{
|
|
}
|
|
|
|
// DELETE /<APIController>/5
|
|
[HttpDelete("{id}")]
|
|
public void Delete(int id)
|
|
{
|
|
}
|
|
}
|
|
}
|