removed unneccesary groupvehicle method
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using ReallifeGamemode.Server.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ReallifeGamemode.Server.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
@@ -14,17 +15,10 @@ namespace ReallifeGamemode.Server.Entities
|
||||
[ForeignKey("Group")]
|
||||
public int? GroupId { get; set; }
|
||||
|
||||
public Group GetGroup()
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
return dbContext.Groups.Where(g => g.Id == GroupId).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Gruppen Fahrzeug | Gruppe: " + Group.Name;
|
||||
using(var dbContext = new DatabaseContext())
|
||||
return "Gruppen Fahrzeug | Gruppe: " + dbContext.GroupVehicles.Include(g => g.Group).First(g => g.Id == this.Id).Group.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user