Fix SharedTrip 500 error

This commit is contained in:
Laura Hausmann 2021-08-16 14:12:00 +02:00
parent ca91093555
commit 2554b89ed2
Signed by: zotan
GPG Key ID: D044E84C5BE01605
1 changed files with 3 additions and 1 deletions

View File

@ -13,8 +13,10 @@ namespace bahnplan.web.Pages {
public void OnGet() {
using var db = new Database.DbConn();
if (!db.Legs.Any(p => p.TripId == int.Parse(Request.Query["id"])))
if (!db.Legs.Any(p => p.TripId == int.Parse(Request.Query["id"]))) {
RedirToIndex = true;
return;
}
Legs = db.Legs.Where(p => p.TripId == int.Parse(Request.Query["id"])).OrderBy(p => p.DepTime).ToList();
User = db.Users.First(p => p.UserId == Legs.First().UserId).Username;