Added many things I can't recall but it has to do with inventory system and some minor fixes .. it's cool
This commit is contained in:
34
ReallifeGamemode.Server/Entities/VehicleItem.cs
Normal file
34
ReallifeGamemode.Server/Entities/VehicleItem.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ReallifeGamemode.Server.Models;
|
||||
|
||||
namespace ReallifeGamemode.Server.Entities
|
||||
{
|
||||
public class VehicleItem
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int ItemId { get; set; }
|
||||
|
||||
[ForeignKey("ServerVehicle")]
|
||||
public int VehicleId { get; set; }
|
||||
public ServerVehicle Vehicle { get; set; }
|
||||
|
||||
public int Amount { get; set; }
|
||||
public int Slot { get; set; }
|
||||
|
||||
public ServerVehicle GetVehicle()
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
return dbContext.ServerVehicles.FirstOrDefault(v => v.Id == VehicleId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user