-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModel.cs
More file actions
48 lines (41 loc) · 1.18 KB
/
Model.cs
File metadata and controls
48 lines (41 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.Text.Json.Serialization;
namespace MinimalBackend;
public enum ProductTypes
{
Food,
Drink
}
public class Product
{
public int Id { get; set; }
public required string Name { get; set; }
public ProductTypes Type { get; set; }
public decimal Price { get; set; }
public bool Hot { get; set; }
public bool? Vegetarian { get; set; }
public required List<Ingredient> Ingredients { get; set; }
}
public class MenuItem
{
[JsonIgnore]
public int MenuNo { get; set; }
[JsonIgnore]
public int ProductId { get; set; }
public Product Product { get; set; } = default!;
[JsonIgnore]
public Menu Menu { get; set; } = default!;
public int Amount { get; set; }
}
public class Menu
{
public int MenuNo { get; set; }
public DateTime Date { get; set; }
public required List<MenuItem> Products { get; set; }
}
public sealed class Ingredient
{
public required string Description { get; set; }
public required List<string> Allergens { get; set; }
}
public sealed record NewProduct(string Name, ProductTypes Type, decimal Price, bool Hot,
bool? Vegetarian, IEnumerable<Ingredient> Ingredients);