campus-errand/server/Models/Dish.cs
2026-03-01 05:01:47 +08:00

36 lines
835 B
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CampusErrand.Models;
/// <summary>
/// 菜品表
/// </summary>
public class Dish
{
[Key]
public int Id { get; set; }
/// <summary>门店 ID</summary>
public int ShopId { get; set; }
/// <summary>菜品名称</summary>
[MaxLength(64)]
public string Name { get; set; } = string.Empty;
/// <summary>菜品照片</summary>
[MaxLength(512)]
public string Photo { get; set; } = string.Empty;
/// <summary>价格</summary>
[Column(TypeName = "decimal(10,2)")]
public decimal Price { get; set; }
/// <summary>是否启用</summary>
public bool IsEnabled { get; set; } = true;
// 导航属性
[ForeignKey(nameof(ShopId))]
public Shop? Shop { get; set; }
}