38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Newtonsoft.Json;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace Server.SQL
|
|
{
|
|
[Table("consumable_item", Schema = "gamedb")]
|
|
public class ConsumableItem
|
|
{
|
|
public int id { get; set; }
|
|
[JsonIgnore]
|
|
public int user_id { get; set; }
|
|
public int consumable_item_data_id { get; set; }
|
|
|
|
public int count { get; set; }
|
|
}
|
|
|
|
public class ConsumableItemSQL : SQL<ConsumableItem>
|
|
{
|
|
public override DbSet<ConsumableItem> table { get; set; }
|
|
|
|
public void Update(ConsumableItem consumableItem)
|
|
{
|
|
table.Update(consumableItem);
|
|
}
|
|
|
|
public override List<ConsumableItem> SelectUid(int user_id)
|
|
{
|
|
return table.Where(data => data.user_id == user_id).ToList();
|
|
}
|
|
|
|
public ConsumableItem SelectItem(int user_id, int consumable_item_id)
|
|
{
|
|
return table.FirstOrDefault(data => (data.user_id == user_id) && (data.id == consumable_item_id));
|
|
}
|
|
}
|
|
}
|