ChessSharp.Web.Controllers.ChessApiController.GetIncomingChallenges C# (CSharp) 메소드

GetIncomingChallenges() 개인적인 메소드

private GetIncomingChallenges ( ) : System.Web.Mvc.ActionResult
리턴 System.Web.Mvc.ActionResult
        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);
        }