This repository has been archived on 2025-04-28. You can view files and clone it, but cannot push or open issues/pull-requests.
DotNetServer/Controllers/ProvinceController.cs

66 lines
2.9 KiB
C#

using Microsoft.AspNetCore.Mvc;
using System;
namespace BHServer.Controllers
{
public class ProvinceController : Controller
{
List<string> MockData = [
"{\"id\": 0, \"name\": \"Hessen\", \"faction\": 2, \"mul\": 1, \"ats\": {\"Allies\": [2, 3, 4], \"Axis\": [1, 5, 9, 10]}, \"state\": 1}",
"{\"id\": 1, \"name\": \"Thuringen\", \"faction\": 2, \"mul\": 1, \"ats\": {\"Allies\": [], \"Axis\": [6, 7, 8]}, \"state\": 0}",
"{\"id\": 2, \"name\": \"Rheinland-Pfalz\", \"faction\": 1, \"mul\": 1, \"ats\": {\"Allies\": [13, 14], \"Axis\": [15]}, \"state\": 1}",
"{\"id\": 3, \"name\": \"Saarland\", \"faction\": 1, \"mul\": 1, \"ats\": {\"Allies\": [16, 17, 18], \"Axis\": []}, \"state\": 0}",
"{\"id\": 4, \"name\": \"Baden-Wurttemberg\", \"faction\": 1, \"mul\": 1, \"ats\": {\"Allies\": [17, 19], \"Axis\": []}, \"state\": 0}",
"{\"id\": 5, \"name\": \"Bayern\", \"faction\": 1, \"mul\": 1, \"ats\": {\"Allies\": [20, 21], \"Axis\": []}, \"state\": 0}",
"{\"id\": 6, \"name\": \"Sachsen\", \"faction\": 1, \"mul\": 1, \"ats\": {\"Allies\": [23], \"Axis\": []}, \"state\": 0}",
"{\"id\": 7, \"name\": \"Brandenburg\", \"faction\": 2, \"mul\": 1, \"ats\": {\"Allies\": [], \"Axis\": [25, 26, 27, 28]}, \"state\": 0}",
"{\"id\": 8, \"name\": \"Berlin\", \"faction\": 2, \"mul\": 1, \"ats\": {\"Allies\": [], \"Axis\": [29, 30, 31]}, \"state\": 0}",
"{\"id\": 9, \"name\": \"Schleswig-Holstein\", \"faction\": 2, \"mul\": 1, \"ats\": {\"Allies\": [], \"Axis\": [33]}, \"state\": 0}",
"{\"id\": 10, \"name\": \"Hamburg\", \"faction\": 2, \"mul\": 1, \"ats\": {\"Allies\": [], \"Axis\": [34]}, \"state\": 0}",
"{\"id\": 11, \"name\": \"Niedersachsen\", \"faction\": 2, \"mul\": 1, \"ats\": {\"Allies\": [], \"Axis\": [35]}, \"state\": 0}",
"{\"id\": 12, \"name\": \"Nordreihn-Westfalen\", \"faction\": 1, \"mul\": 1, \"ats\": {\"Allies\": [36, 37], \"Axis\": []}, \"state\": 0}"
];
public IActionResult Index()
{
return View();
}
[HttpGet]
public IEnumerable<string> Get()
{
return MockData;
}
// GET /<APIController>/5
[HttpGet("{id}")]
public string Get(int id)
{
var entry = MockData.ElementAt(id);
return entry;
}
// POST /<APIController>
[HttpPost]
public void Post([FromBody] string value)
{
// TODO: Implement
}
// PUT /<APIController>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
// TODO: Implement
}
// DELETE /<APIController>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
// TODO: Implement
}
}
}