| | | 1 | | using Snacks.Domain.Abstractions; |
| | | 2 | | |
| | | 3 | | namespace Snacks.Domain.Models; |
| | | 4 | | |
| | | 5 | | public class OrderItem : IOrderItem |
| | | 6 | | { |
| | 98 | 7 | | public int Id { get; set; } = 0; |
| | 82 | 8 | | public int OrderId { get; set; } = 0; |
| | 82 | 9 | | public int Qty { get; set; } = 0; |
| | 86 | 10 | | public double Price { get; set; } = 0.0; |
| | 84 | 11 | | public string? Name { get; set; } = null; |
| | 32 | 12 | | public OrderItem() |
| | 32 | 13 | | { |
| | 32 | 14 | | } |
| | 4 | 15 | | public OrderItem(int id, int orderId, int qty, double price, string name) |
| | 4 | 16 | | { |
| | 4 | 17 | | Id = id; |
| | 4 | 18 | | OrderId = orderId; |
| | 4 | 19 | | Price = price; |
| | 4 | 20 | | Qty = qty; |
| | 4 | 21 | | Name = name; |
| | 4 | 22 | | } |
| | | 23 | | public override string ToString() |
| | 2 | 24 | | { |
| | 2 | 25 | | return $"Id: {Id}, OrderId: {OrderId}, Qty: {Qty}, Price: {Price}, Name: {Name}"; |
| | 2 | 26 | | } |
| | | 27 | | |
| | | 28 | | public int CompareTo(IOrderItem? other) |
| | 0 | 29 | | { |
| | 0 | 30 | | if (other == null) return 1; |
| | 0 | 31 | | return this.Id.CompareTo(other.Id); |
| | 0 | 32 | | } |
| | | 33 | | } |