load up a match
This commit is contained in:
parent
b6f427d629
commit
3f6bb38788
@ -1,6 +1,7 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Sequence.Entities;
|
using Sequence.Entities;
|
||||||
using Sequence.Models;
|
using Sequence.Models;
|
||||||
|
|
||||||
@ -27,13 +28,18 @@ public class HomeController : Controller
|
|||||||
var userId = Guid.Parse("08db379a-5de8-420d-8232-1bb60fdf249b");
|
var userId = Guid.Parse("08db379a-5de8-420d-8232-1bb60fdf249b");
|
||||||
|
|
||||||
var match = dbContext.Matches
|
var match = dbContext.Matches
|
||||||
|
.Include(m => m.Deck)
|
||||||
|
.Include(m => m.PlayerOne)
|
||||||
|
.ThenInclude(p => p.HandCards)
|
||||||
|
.Include(m => m.PlayerTwo)
|
||||||
|
.ThenInclude(p => p.HandCards)
|
||||||
.OrderByDescending(m => m.Created)
|
.OrderByDescending(m => m.Created)
|
||||||
|
.AsSplitQuery()
|
||||||
.FirstOrDefault(m => m.PlayerOne.UserId == userId || m.PlayerTwo.UserId == userId);
|
.FirstOrDefault(m => m.PlayerOne.UserId == userId || m.PlayerTwo.UserId == userId);
|
||||||
|
|
||||||
if (match != null)
|
|
||||||
{
|
|
||||||
|
return View();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> CreateMatch(Guid userOneGuid, Guid userTwoGuid)
|
public async Task<IActionResult> CreateMatch(Guid userOneGuid, Guid userTwoGuid)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user