From a7688efcb99fc8172275762ea39839e1af7fac54 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 8 Jul 2023 08:11:39 -0400 Subject: [PATCH] add a getmatch endpoint --- Controllers/HomeController.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Controllers/HomeController.cs b/Controllers/HomeController.cs index 96c327f..8139038 100644 --- a/Controllers/HomeController.cs +++ b/Controllers/HomeController.cs @@ -42,6 +42,19 @@ public class HomeController : Controller return View(); } + public IActionResult GetMatch(Guid id) + { + var match = dbContext.Matches + .Include(m => m.Deck) + .Include(m => m.PlayerOne) + .ThenInclude(p => p.HandCards) + .Include(m => m.PlayerTwo) + .ThenInclude(p => p.HandCards) + .FirstOrDefault(m => m.Id == id); + + return Ok(match); + } + public async Task CreateMatch(Guid userOneGuid, Guid userTwoGuid) { var playerOne = new Player