public override GetPlayersOfUnfinishedChallanges Perform(GetPlayersOfUnfinishedChallanges query)
        {
            var yesterday = DateTimeGetter.GetDateTime().AddDays(-1);

            query.QueryResult = DbContext.Challenges
                                .Where(x => x.Status == ChallengeStatus.InProgress && yesterday <= x.StartDate)
                                .Select(x => x.Player)
                                .ToList();

            return(query);
        }
Example #2
0
        public override void Execute(BeginChallange command)
        {
            var challenge = DbContext.Challenges.SingleOrDefault(c => c.Id == command.Id);

            if (challenge == null)
            {
                return;
            }

            challenge.Status    = ChallengeStatus.InProgress;
            challenge.StartDate = DateTimeGetter.GetDateTime();
            DbContext.SaveChanges();
        }