thewar_server/Server/SQL/Equipment.cs

38 lines
1.0 KiB
C#

using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations.Schema;
namespace Server.SQL
{
[Table("equipment", Schema = "gamedb")]
public class Equipment
{
public long id { get; set; }
[JsonIgnore]
public long user_id { get; set; }
public long equip_unit { get; set; }
public int rand_stats { get; set; }
public long equipment_data_id { get; set; }
}
public class EquipmentrSQL : SQL<Equipment>
{
public override DbSet<Equipment> table { get; set; }
public void Update(Equipment equipment)
{
table.Update(equipment);
}
public override List<Equipment> SelectUid(long user_id)
{
return table.Where(data => data.user_id == user_id).ToList();
}
public Equipment SelectItem(long user_id, long equipment_id)
{
return table.FirstOrDefault(data => (data.user_id == user_id) && (data.id == equipment_id));
}
}
}