LapTimesDTO

This commit is contained in:
ntr committed 2023-08-30 12:05:55 +10:00
1 parent 6450d3b093
commit 900ee4412d
3 files changed
+24 -7

No files matched your search

+13 -3
View File
@@ -17,12 +17,22 @@ public class PbController : ControllerBase {
}
[HttpGet()]
public PbDTO Pb(Guid userId, string mapName) {
public LapTimesDTO Pb(Guid userId, string mapName) {
_logger.LogInformation($"{userId} {mapName}");
return _db.PbDTO
PbDTO pb = _db.PbDTO
.Where(pb => pb.UserId == userId)
.Where(pb => pb.Map == mapName)
.Single();
.SingleOrDefault();
PbDTO lapRecord = _db.PbDTO
.Where(pb => pb.Map == mapName)
.OrderBy(pb => pb.Position)
.FirstOrDefault();
return new LapTimesDTO {
Pb = pb,
LapRecord = lapRecord,
};
}
}
+5
View File
@@ -22,4 +22,9 @@ namespace SpaceRace.Shared {
public int Completions { get; set; }
public int Position { get; set; }
}
public class LapTimesDTO {
public PbDTO Pb { get; set; }
public PbDTO LapRecord { get; set; }
}
}