public ActionResult GetIncomingChallenges()
{
var challenges =
UnitOfWork.All<Challenge>(c => c.ChallengingPlayer.Id != CurrentUser.Id && c.Accepted == null)
.Where(c => c.LightPlayer.Id == CurrentUser.Id || c.DarkPlayer.Id == CurrentUser.Id);
var openChallenges = challenges.Select(c => new ExistingChallengeViewModel()
{
Accepted = false,
ChallengeTitle = c.Title,
DateTime = c.DateTime,
Id = c.ChallengeId,
Opponent = c.ChallengingPlayer,
OpponentTeam = c.LightPlayer == c.ChallengingPlayer ? Team.Light : Team.Dark
}).ToList();
return Json(openChallenges, JsonRequestBehavior.AllowGet);
}