// GET: api/ApiGame [HttpGet] public ActionResult<IEnumerable<ApiGameMoveModel>> Get() { // TODO ~ use db context to select a list
// TODO ~ if none exist `return NotFound();`
returnnew JsonResult(new List<ApiGameMoveModel> { new ApiGameMoveModel() { Id = 42, Player = "player in list that was selected" }, new ApiGameMoveModel() { Id = 43, Player = "player in list that was selected" } }); }
// GET: api/ApiGame/5 [HttpGet("{id}")] public ActionResult<ApiGameMoveModel> Get(int id) { // TODO ~ use db context to select on `id`
// TODO ~ check id exists, if it doesnt `return NotFound();`
returnnew ApiGameMoveModel() { Id = id, Player = $"player that was selected on {id}" }; }
// PUT: api/ApiGame/5 [HttpPut("{id}")] public IActionResult Put(int id, ApiGameMoveModel apiGameMoveModel) { if (id != apiGameMoveModel.Id) return BadRequest();
// TODO ~ check id exists, if it doesnt `return NotFound();`
// TODO ~ use db context to update
return NoContent(); }
// POST: api/ApiGame [HttpPost] public IActionResult Post(ApiGameMoveModel apiGameMoveModel) { // TODO ~ use db context to update
var response = new ApiGameMoveModel { Id = 42, Player = "player that was updated" }; returnnew JsonResult(response); }
// DELETE: api/ApiGame/5 [HttpDelete("{id}")] public ActionResult<ApiGameMoveModel> Delete(int id) { // TODO ~ use db context to select on `id` // if not found, return NotFound();
// TODO ~ use db context to do the delete // TODO ~ return the model selected by `id` returnnew ApiGameMoveModel(){ Id = id, Player = "player that was deleted" }; } } }