40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Newtonsoft.Json;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace Server.SQL
|
|
{
|
|
[Table("equipment", Schema = "gamedb")]
|
|
public class Equipment
|
|
{
|
|
[Key]
|
|
public int id { get; set; }
|
|
[JsonIgnore]
|
|
public int user_id { get; set; }
|
|
public long equipment_data_id { get; set; }
|
|
public int equip_unit { get; set; }
|
|
public int rand_stats { 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(int user_id)
|
|
{
|
|
return table.Where(data => data.user_id == user_id).ToList();
|
|
}
|
|
|
|
public Equipment SelectItem(int user_id, int equipment_id)
|
|
{
|
|
return table.FirstOrDefault(data => (data.user_id == user_id) && (data.id == equipment_id));
|
|
}
|
|
}
|
|
}
|