| | | 1 | | using Snacks.Domain.Abstractions; |
| | | 2 | | |
| | | 3 | | namespace Snacks.Domain.Models; |
| | | 4 | | |
| | | 5 | | public class Product : IProduct |
| | | 6 | | { |
| | 120 | 7 | | public int Id { get; set; } = 0; |
| | 106 | 8 | | public string? Name { get; set; } = null; |
| | 96 | 9 | | public string? Description { get; set; } = null; |
| | 98 | 10 | | public decimal Price { get; set; } = 0; |
| | 96 | 11 | | public int CategoryId { get; set; } = 0; |
| | 94 | 12 | | public int RestaurantId { get; set; } = 0; |
| | | 13 | | |
| | 38 | 14 | | public Product() |
| | 38 | 15 | | { |
| | 38 | 16 | | } |
| | 6 | 17 | | public Product(int id, string name, string description, decimal price, int categoryId, int restaurantId) |
| | 6 | 18 | | { |
| | 6 | 19 | | Id = id; |
| | 6 | 20 | | Name = name; |
| | 6 | 21 | | Description = description; |
| | 6 | 22 | | Price = price; |
| | 6 | 23 | | CategoryId = categoryId; |
| | 6 | 24 | | RestaurantId = restaurantId; |
| | 6 | 25 | | } |
| | | 26 | | public override string ToString() |
| | 2 | 27 | | { |
| | 2 | 28 | | return $"Id: {Id}, Name: {Name}, Description: {Description}, Price: {Price}, CategoryId: {CategoryId}, Restauran |
| | 2 | 29 | | } |
| | | 30 | | public int CompareTo(IProduct? other) |
| | 0 | 31 | | { |
| | 0 | 32 | | if (other == null) return 1; |
| | 0 | 33 | | return this.Id.CompareTo(other.Id); |
| | 0 | 34 | | } |
| | | 35 | | } |