removed unneccesary groupvehicle method

This commit is contained in:
hydrant
2019-05-10 21:16:43 +02:00
parent a68c4fd254
commit ecae6fb7ba

View File

@@ -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;
}
}
}