Пример #1
0
 public static Task <DbScore> GetLatestScore(
     SoraDbContext ctx,
     DbScore newerScore
     ) => ctx.Scores.Where(x =>
                           x.FileMd5 == newerScore.FileMd5 &&
                           x.UserId == newerScore.UserId &&
                           x.PlayMode == newerScore.PlayMode)
 .OrderByDescending(x => x.TotalScore)
 .FirstOrDefaultAsync();
Пример #2
0
        public static async Task InsertScore(SoraDbContext ctx, DbScore score)
        {
            var so = score.ScoreOwner; // Fix for an Issue with Inserting.

            score.ScoreOwner = null;
            ctx.Add(score);

            score.ScoreOwner = so; // Restore ScoreOwner

            await ctx.SaveChangesAsync();
        }
Пример #3
0
 public static Task <DbScore> GetScore(
     SoraDbContext ctx,
     DbScore otherScore
     ) => ctx.Scores.Where(x => x.Checksum == otherScore.Checksum).FirstOrDefaultAsync();