diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 50f25e37..73d0591d 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -17,6 +17,7 @@ using ReallifeGamemode.Server.Models; using ReallifeGamemode.Server.Job; using ReallifeGamemode.Server.Finance; using ReallifeGamemode.Server.Wanted; +using Microsoft.EntityFrameworkCore; /** * @overview Life of German Reallife - Admin Commands (Admin.cs) @@ -2598,6 +2599,12 @@ namespace ReallifeGamemode.Server.Commands dbContext.Users.Where(u => u.Id == nearHouse.OwnerId).First().HouseId = null; } + foreach (HouseRental rental in dbContext.HouseRentals.Include(r => r.User).Where(r => r.HouseId == nearHouse.Id)) + { + rental.User.Client?.SendChatMessage("Dein Mietvertrag wurde administrativ aufgelöst"); + dbContext.HouseRentals.Remove(rental); + } + dbContext.Houses.Remove(nearHouse); dbContext.SaveChanges();