flower-story/Server/Data/Model/FlowerItem.cs
2023-05-23 08:37:20 +08:00

33 lines
825 B
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Blahblah.FlowerStory.Server.Data.Model;
[Table("flowers")]
public class FlowerItem
{
[Column("fid"), Key, Required]
public int Id { get; set; }
[Column("categoryid"), Required]
public int CategoryId { get; set; }
[Column("name"), Required]
public required string Name { get; set; }
[Column("datebuy"), Required]
public long DateBuyUnixTime { get; set; }
[Column("cost", TypeName = "real")]
public decimal? Cost { get; set; }
[Column("purchase")]
public string? Purchase { get; set; }
[Column("photo")]
public byte[]? Photo { get; set; }
[NotMapped]
public DateTimeOffset DateBuy => DateTimeOffset.FromUnixTimeMilliseconds(DateBuyUnixTime);
}