returning pb

This commit is contained in:
ntr committed 2023-08-29 13:52:19 +10:00
1 parent 9f857aeeda
commit 0b2d4ccd14
7 files changed
+141 -45

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Data.SqlClient;
using Server.Models;
namespace Server.Controllers;
[ApiController]
[Route("[controller]")]
public class PbController : ControllerBase {
private readonly ILogger<PbController> _logger;
private SpaceRaceDbContext _db;
public PbController(ILogger<PbController> logger, SpaceRaceDbContext db) {
_logger = logger;
_db = db;
}
[HttpGet()]
public PbDTO Pb(Guid userId, string mapName) {
_logger.LogInformation($"{userId} {mapName}");
return _db.PbDTO
.Where(pb => pb.UserId == userId)
.Where(pb => pb.Map == mapName)
.Single();
}
}