using Wonky.Entity.DTO; namespace Wonky.Entity.Models; public class DraftItem { public int Quantity { get; set; } public SalesItemDto Item { get; set; } public decimal Price { get; set; } public decimal Total { get { var price = (from x in Item.Rates where x.Quantity == Quantity.ToString() select x.Rate).First(); if (string.IsNullOrWhiteSpace(price)) price = Item.Rates[0].Rate; Price = Convert.ToDecimal(price); return Price * Quantity; } } } public class Draft { public List Items { get; set; } = new List(); public decimal Total { get { return Items.Sum(item => item.Total); } } public DateTime LastAccessed { get; set; } public int TimeToLiveInSeconds { get; set; } = 300; // default }